DEV Community

SELVAKUMAR R
SELVAKUMAR R

Posted on

Data type in Java

Attribute that tell a computer system what kind of value a variable holds and how to interpret it

In Java datatype is classified in to two types

  1. primitive Datatype
  2. Non primitive (Reference) Datatype

1. primitive Datatype:

1. byte

It is used to store the small whole number from -128 to 127

2. short
It is used to store the whole number from -32768 to 32767

3. int
It is used to store the whole number from - 2 billion to 2 billion

4.long
It is used to store the whole number 9 quintillion add L at end of the whole number

5. float
It store the decimal number up to 7 digit including the f at end of the decimal number

6. double
It store the decimal number up to 16 digit including the decimal

7. Boolean
It is used to provide the logical value true or false

8. char
It is used to store the single character

2. Non primitive datatype

String -> Used for storing text

Array -> Used to store multiple value in a single variable

Classes -> Used as a blueprint for creating objects

Top comments (0)