Java Data Types

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 c…


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:

  1. 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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Java Data Types." Dev Ananth Arul | Sciencx - Tuesday October 14, 2025, https://www.scien.cx/2025/10/14/java-data-types-2/
HARVARD
Dev Ananth Arul | Sciencx Tuesday October 14, 2025 » Java Data Types., viewed ,<https://www.scien.cx/2025/10/14/java-data-types-2/>
VANCOUVER
Dev Ananth Arul | Sciencx - » Java Data Types. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/14/java-data-types-2/
CHICAGO
" » Java Data Types." Dev Ananth Arul | Sciencx - Accessed . https://www.scien.cx/2025/10/14/java-data-types-2/
IEEE
" » Java Data Types." Dev Ananth Arul | Sciencx [Online]. Available: https://www.scien.cx/2025/10/14/java-data-types-2/. [Accessed: ]
rf:citation
» Java Data Types | Dev Ananth Arul | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.