Java Scrap Book

Java Scrap Book > Data Type > Primitive Data Type Limit

Primitive Data Type Limit

Primitive data type limits are saved in Primitive wrapper classes e.g ( Byte,Short,Integer,Float,Double)
public class  PrimitiveDataTypeSize{

   public static void  main (String args[ ]){
    System.out.println("Min byte datatype value = " + Byte.MIN_VALUE);
    System.out.println("Max byte datatype value = "+ Byte.MAX_VALUE);
    System.out.println("Min short datatype value = " + Short.MIN_VALUE);
    System.out.println("Max short datatype value = " + Short.MAX_VALUE);
    System.out.println("Min int datatype value = " + Integer.MIN_VALUE);
    System.out.println("Max int datatype value = " + Integer.MAX_VALUE);
    System.out.println("Min float datatype value = " + Float.MIN_VALUE);
    System.out.println("Max float datatype value = " + Float.MAX_VALUE);
    System.out.println("Min double datatype value = " + Double.MIN_VALUE);
    System.out.println("Max double datatype value = " + Double.MAX_VALUE);
    }
   }

Result

Min byte datatype value = -128
Max byte datatype value = 127
Min short datatype value = -32768
Max short datatype value = 32767
Min int datatype value = -2147483648
Max int datatype value = 2147483647
Min float datatype value = 1.4E-45
Max float datatype value = 3.4028235E38
Min double datatype value = 4.9E-324
Max double datatype value = 1.7976931348623157E308

Copyright © 2013-2017

javascrapbook.com is a computer science content service should not be treated as the publisher or speaker of any information provided by another Computer Science content provider.

Contact email: javascrapbook2013@gmail.com