Java is statically typed programming language which means variable types are known at the compile time.
Java Data Type Categories:
Primitive Data Type:
These are the basic building blocks that store simple values directly in memory. Examples of primitive data types are boolean, char, byte, short, int, long, float and double.
Non-Primitive Data Types (Object Types):
These are reference types that store memory addresses of objects. Examples of Non-primitive data types are String, Array, Class, Interface and Object.
Type of Primitive Data Type
-
byte: A very small integer, using 1 byte of memory. -
short: A small integer, using 2 bytes of memory. -
int: The standard integer type, typically using 4 bytes. -
long: A large integer type, using 8 bytes of memory for very large numbers -
float: Stores single-precision floating-point numbers, using 4 bytes. -
double: Stores double-precision, larger floating-point numbers with greater precision, using 8 bytes. -
char: Represents a single character (like 'a' or '5') and stores it as a 16-bit Unicode character in languages like Java. -
boolean: Represents a logical value, which can only be true or false
HAPPY CODING...

Top comments (0)