What are different data types in Java?

948    Asked by PRATEEKArora in QA Testing , Asked on Dec 28, 2019
Answered by PRATEEK Arora

n java, to create a function or perform any action we need variables and since Java is statically typed programming language, so it becomes important to define variables before its being used.

The syntax for defining variable in java is: Data-type Variable-name;

There are two different data types in Java 


  1. Primitive data Types: These are predefined data types in Java. There are eight different primitive data types. These are – Boolean, char, byte, short, int, long, float, double. These are reserved keywords. 
  2. Non-Primitive data types: This is also known as user defined data types or reference data types. These are created by the programmers. They refer to an object. 



Your Answer

Interviews

Parent Categories