Data type and Type casting in java

Data Type :

ther 2 type of Data Type in java 1.premetive 2.non premetive

1.  PREMMETIVE:-

type

decleration

size

ex

integer

byte

1byte

10

integer

short

2byte

20000

integer

int

4byte

9800028

integer

long

8byte

31387827987878

decimal

float

12.321

decimal

double

1.27292

character

char

‘A’

boolean

boolean

true/false

 

NON PREMEIVE:-  CLASSES INTERFERENCE AND ARRAYS.

 

TYPE CASTING:-

typecasting is a process of converting the value of one data type to another. there is 2 types of type casting

AUTOMATIC:-

we can write right side value in left side

Byte->short->char->int->long->float->double

 

manual:-

ex.1-  int x = 2.3829;

double y = (double)x;

 

ex.2-    byte y = 3;

int z = (int)y;

Rishabh

I want to change the world with the help of tech 🙃

Leave a Reply