Skip to content

Data Types

Java is strongly-typed language.

int x = 10.5; 
boolean b = 0; 

Java doesn't support 1/0 as boolean data like C/C++ .

  • Every variable and expression has a type.
  • Every type is strictly defined.
  • Every assignment should be checked by compile type compatibility.

Note :

if(1){ // Needs true / false.
    //doesn't run
}

No operator overloading, multiple inheritance are supported in Java.

Syntax:

data_type identifier = literal ;

Data Types in Java

ADT - derived from Primitive Data Type and performs action.