When we are study any Programming language the main thing how to Declare any variable so that we can easily work with programming language , so we have to learn firstly data type of programming language .
So hear i will discuss the some basic data type of the JAVA language.
1. Integer Data Type :- It is used for any numeric value used in program . It consist finite subset of numerics for. e.g is may be signed or unsigned .
There are 4 type of Integers used in JAVA:
byte:
1 signed byte ( 8-Bit Size), Its range value lie between -128 to 127.
It is used to save the memory in large array, it can also used in the place of "int" where the variable range is limited.
Syntax : byte variable_name; e.g. byte a,b=5;
short
2 bytes, signed ( 16 -Bit Size), Its range value lie between -32,768 to 32,767.
We can also use it to save the memory in case of large array size.
Syntax : short variable_name; e.g. short a,b=5;
int
4 bytes, signed (32 -Bit Size), Its range value lie between -2,147,483,648 to 2,147,483,647, It is used generally for the default size integer data type .
Syntax : int variable_name; e.g. int a,b=5;
long
8 bytes signed (64 -Bit Size). Its range value lie between -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, It is used when the we used wider range value from "int" .
Syntax : long variable_name; e.g. long a,b=5;
No comments:
Post a Comment