Java Program to print Range of all Data Types
Notes:
Java Program to print Range of all Data Types:
- How to find and print range of data types in java
Example Code:
package rangeofalltypesdemo;
public class RangeofAllTypesDemo {
public static void main(String[] args) {
System.out.println("byte min = " + Byte.MIN_VALUE); // -128
System.out.println("byte max = " + Byte.MAX_VALUE); // 127
System.out.println();
System.out.println("short min = " + Short.MIN_VALUE); // -32768
System.out.println("short max = " + Short.MAX_VALUE); // 32767
System.out.println();
System.out.println("int min = " + Integer.MIN_VALUE); // -2147483648
System.out.println("int max = " + Integer.MAX_VALUE); // 2147483647
System.out.println();
System.out.println("long min = " + Long.MIN_VALUE); // -9,223,372,036,854,775,808
System.out.println("long max = " + Long.MAX_VALUE); // 9,223,372,036,854,775,807
System.out.println();
System.out.println("float min = " + Float.MIN_VALUE); // 1.4E-45
System.out.println("float max = " + Float.MAX_VALUE); // 3.4E+38
System.out.println();
System.out.println("double min = " + Double.MIN_VALUE); // 4.9E-324
System.out.println("double max = " + Double.MAX_VALUE); // 1.7E+308
System.out.println();
}
}