Data Types in Java

In this article we are going to discuss about data types in java.

data type is set of possible values and set of allowed operation on it. it specify different sizes and vales that can be stored in a variable.

There are two type of data types in java:-

  1. Primitive data type
  2. Non -primitive data type

Primitive data types in java:-

In java there are 8 primitive data types is present. which are given below.

  • int : size – 4 bytes, default value=0.
  • byte : size – 1 bytes, default value=0.
  • short : size – 2 bytes, default value=0.
  • long : size – 8 bytes, default value=0.
  • float : size – 4 bytes, default value=0.0
  • char : size – 2 bytes, default value= “/u0000”.
  • double : size – 8 bytes, default value= 0.0.
  • boolean : size – N/A, default value= false.

Non Primitive data types in java :-

Non primitive data types are the types which belong to a Class, an interface or an Array. Non primitive data type variables are also known as referenced data type in java. Examples – Array, String etc.

Identifiers in java https://gangforcode.com/identifiers-in-java/
Keywords in java https://gangforcode.com/keywords-in-java/

9 thoughts on “Data Types in Java”

Leave a Comment