Computer Science, asked by prajwaljoy8, 6 months ago

WHAT IS THE CLASSIFICATION OF DATA TYPES IN JAVA ? ( WITHOUT DIAGRAM EXPLAIN IN DETAIL)​

Answers

Answered by arunsharmakknews
1

Answer:

Data type specifies the size and type of values that can be stored in an identifier. The Java language is rich in its data types. Different data types allow you to select the type appropriate to the needs of the application.

Data types in Java are classified into two types:

Primitive—which include Integer, Character, Boolean, and Floating Point.

Non-primitive—which include Classes, Interfaces, and Arrays.

Primitive Data Types

1. Integer

Integer types can hold whole numbers such as 123 and −96. The size of the values that can be stored depends on the integer type that we choose.

Type Size Range of values that can be stored

byte 1 byte −128 to 127

short 2 bytes −32768 to 32767

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,755,807

The range of values is calculated as −(2n−1) to (2n−1)−1; where n is the number of bits required. For example, the byte data type requires 1 byte = 8 bits. Therefore, the range of values that can be stored in the byte data type is −(28−1) to (28−1)−1

= −27 to (27) -1

= −128 to 127

2. Floating Point

Floating point data types are used to represent numbers with a fractional part. Single precision floating point numbers occupy 4 bytes and Double precision floating point numbers occupy 8 bytes. There are two subtypes:

Type Size Range of values that can be stored

float 4 bytes 3.4e−038 to 3.4e+038

double 8 bytes 1.7e−308 to 1.7e+038

3. Character

It stores character constants in the memory. It assumes a size of 2 bytes, but basically it can hold only a single character because char stores unicode character sets. It has a minimum value of ‘u0000’ (or 0) and a maximum value of ‘uffff’ (or 65,535, inclusive).

4. Boolean

Explanation:

hope it's helpful to you pls mark me as brainlist and follow me and thank me if it's helpful to you it's very important to me

Answered by CHERRYNATH
0

Answer:

data types are classified into

Similar questions