Data Types:dd
Data type means it represents which type of value to store in a variable.In java programming we are data types like int,char,float,double,short,string,boolean.
package datatypes;
public class datatypesexp
{
public static void main(String[] args)
{
int i = 10; //can stores integer value of 32 bit
long l = 458967; //can store 64 bit value
double d1 = 47.523; //stores 64 bit decimal value
char c = 'N'; //Can store single character only.
boolean t = true; //Can store only boolean values like true or false.
String str = "JAVA"; //Can store any string values.
System.out.println("Integer value is : "+i);
System.out.println("Long value is :"+l);
System.out.println("double value is :"+d1);
System.out.println("char value is : "+c);
System.out.println("boolean value is : "+t);
System.out.println("boolean value is : "+str);
}
}
Output:
Integer value is : 10
Long value is :458967
double value is :47.523
char value is : N
boolean value is : true
boolean value is : JAVA
No comments:
Post a Comment