Data Types in java

Basic Datatype chart in java.

As shown in the above figure, there are two types of datatypes.

Primitive Data Type

In java, primitive datatypes are the building blocks of the data manipulation. Primitive data types include int, float, char, double, short, long, boolean, byte.

Non – Primitive Datatype

Nonprimitive datatype includes Strings, Arrays, and Classes. Non – primitive datatypes are also known as reference types because they refer to objects

There are four​ types of non-primitive data:

  • array: This data type is used to store data in a consecutive manner. It can store any type of data as the size of the array is also declared by the programmer.
  • String: This data type is used to store characters or proper sentences . For Example String string = "Java is the Object Oriented programming language.";).
  • class: Classes are used to create objects. They are a very well-mannered way of merging different pieces of data into a single object.
  • interface: An interface is like a dashboard or control panel for a class. It has buttons/functions for the data types defined, but the implementation is somewhere else.

Rutu Shah