Java                                                          Home : www.sharetechnote.com

 

 

 

 

Java - Data Type

 

Many people say 'In Java, everything is a class'. However, it support several very basic data types called 'Primitive Data Types' as shown below. These are the same data type that are supported by other languages like C.

 

 

Primitive Data Types

 

 

Type

Description

Size

Example Literals

boolean

true or false

1 bit

truefalse

byte

2's complement integer

8 bits (1 byte)

(none)

char

Unicode character

16 bits (2 bytes)

'a''\u0041''\101''\\''\'''\n'''

short

2's complement integer

16 bits (2 bytes)

(none)

int

2's complement integer

32 bits (4 bytes)

-2-1012

long

2's complement integer

64 bits (8 bytes)

-2L-1L0L1L2L

float

IEEE 754 floating point

32 bits (4 bytes)

1.23e100f-1.23e-100f.3f3.14F

double

IEEE 754 floating point

64 bits (8 bytes)

1.23456e300d-1.23456e-300d1e1d

 

 

 

Non-Primitive Data Types

 

 

Type

Description

Array

 

String