Monday, May 27, 2013

How to check datatype in java!

Hi community!
I have sample code for checking datatype in java. Let's go to check it!

public class DataTypeInJava {
public static void main(String[] args) {

System.out.println("\nFor byte datatype");
System.out.println("Max "+ Byte.MAX_VALUE);
System.out.println("Mix "+ Byte.MIN_VALUE);
System.out.println("Size :"+ Byte.SIZE+ "bits");

System.out.println("\nFor short datatype");
System.out.println("Max "+ Short.MAX_VALUE);
System.out.println("Mix "+ Short.MIN_VALUE);
System.out.println("Size :"+ Short.SIZE+ "bits");

System.out.println("\nFor int datatype");
System.out.println("Max "+ Integer.MAX_VALUE);
System.out.println("Mix "+ Integer.MIN_VALUE);
System.out.println("Size :"+ Integer.SIZE+ "bits");

System.out.println("\nFor long datatype");
System.out.println("Max "+ Long.MAX_VALUE);
System.out.println("Mix "+ Long.MIN_VALUE);
System.out.println("Size :"+ Long.SIZE+ "bits");

System.out.println("\nFor float datatype");
System.out.println("Max "+ Float.MAX_VALUE);
System.out.println("Mix "+ Float.MIN_VALUE);
System.out.println("Size :"+ Float.SIZE+ "bits");

System.out.println("\nFor double datatype");
System.out.println("Max "+ Double.MAX_VALUE);
System.out.println("Mix "+ Double.MIN_VALUE);
System.out.println("Size :"+ Double.SIZE+ "bits");

System.out.println("\nFor boolean datatype");
System.out.println("Type "+ Boolean.FALSE +" and "+ Boolean.TRUE);

System.out.println("\nFor character datatype");
System.out.println("Size "+ Character.SIZE);
System.out.println("Type "+ Character.TYPE);


}
}

No comments:

Post a Comment