This content originally appeared on DEV Community and was authored by Dev Ananth Arul
Java is statically typed programming language which means variable types are known at the compile time.
In Java, compiler knows exactly what types each variable holds and enforces correct usage during compilation. For example "int x = "GfG";" gives compiler error in Java as we are trying to store string in an integer type.
Data types in Java are of different sizes and values that can be stored in a variable that is made as per convenience and circumstances to handle different scenarios or data requirements.
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.
2.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.
This content originally appeared on DEV Community and was authored by Dev Ananth Arul

Dev Ananth Arul | Sciencx (2025-10-14T17:18:30+00:00) Java Data Types. Retrieved from https://www.scien.cx/2025/10/14/java-data-types-2/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.