about Java data type

 Java data type

 




We usually store data in computers using some data type.

For example, video files are stored as mp4 and audio files as mp3. Because without it, we cannot use any data for processing. Therefore, we have to deal with data while creating Java programs, so we use several types of data.

There are mainly three parts to this data type

01. Integer numbers

02. Decimal numbers

03. Binary numbers

 

01. Integer numbers

                       

Type

Size

Minimum

Value

Maximum

Value

Range

Example

Long

64

-263

263-1

All numeric value

Not end

Int

32

-231

231-1

All numeric value

I=1234567

Short

16

-215

215-1

+32767 to -32767

S=3245

Char

16

0

216-1

All Unicode

C=’123abc’

Byte

8

-128

127

+127 to -127

Byte =65

 


02. Decimal numbers

Type

Size

Maximum value

Minimum value

Range

Example

Double

64

-21074

-21074-1

All numeric numbers

F=1024.45

float

32

-2149

-2149-1

All numeric numbers

X=625.45

 

03. Binary numbers

 

Type: Boolean

Size :1

Range: (1,0) or true /false

 

String

String is a Pre Build class, not a data type but this class we use as a data type which is called as a nonprimitive data type. This data type especially any data can be assigned.

Example:

String s1=”123456789”;

String s2=”abcdefghijk”;

String s2=”!@#$%^&*”;

 

No comments:

Post a Comment

Pages