JAVA

Java Data type (primitive & non-primitive)

seoca 2018. 12. 18. 15:33



Primitive Data Types

Data Type

 Size

 Description 

 byte

 1 byte (8-bit)

 -128 to 127

 short

 2 bytes 

 -32,768 to 32,767

 int

 4 bytes

 -2,147,483.648 to 2,147,483,647

 long

 8 bytes

  -9,223.372,036.854,775.808 to 9,223.372,036,854,775,808

 float

 4 bytes

 6 to 7 decimal digits

 double

 8 bytes

 15 decimal digits

 boolean

 1 byte

 true or false

 char

 2 bytes

 a single character or letter 



Non-primitive Data Types


Non-primitive data types don't store value but store a reference of the value. 

* reference type - Array, Variable, Class, Interface




Reference

Hackerrank (https://www.hackerrank.com/)

w3schools (www.w3schools.com)