What are the primitive data types in Java?

TypeSizeDefault valueRange or values
byte8 bit0-128 to 127
short16 bit0-32,768 to 32,767
int32 bit0about -2.1 billion to 2.1 billion
long64 bit0Lvery big whole numbers
float32 bit0.0fdecimal, about 7 digits
double64 bit0.0decimal, about 15 digits
char16 bit‘\u0000’one Unicode character
booleannot definedfalsetrue or false
public class Main {
    public static void main(String[] args) {
        System.out.println(Integer.MAX_VALUE);
        System.out.println(Long.MAX_VALUE);
        System.out.println((int) Character.MAX_VALUE);
    }
}
Output

2147483647
9223372036854775807
65535

Every other type is a reference type. See Java Data Types.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.