datatypes and variables in java in Hindi
Автор: Tarun Sir
Загружено: 2022-06-30
Просмотров: 412
Описание:
In this video you will learn that what is variable and datatype in java.
Variables and Datatype in Java
Variable
A variable is a name given to the memory location.
A variable is used to store value.
We can change the value of variable when needed.
Every variable in java program must be declared before it is used.
To create every variable(declare) we use datatype.
Datatype
The datatypes are keywords which are used to declare the variables.
The datatype decides the type of value that can be stored in the variable.
The datatype decides what is the size of the memory location which is used as variable/ by variable.
The datatype also decides the range of the values that can be stored in the variable.
The syntax for creating variable is as follows:
datatype variable_name=value;
The following table shows all 8 primary datatypes available in java:
Datatype Type of value Size Range
byte Integer 1 byte -128 to 127
short Integer 2 byte -32768 to 32767
int Integer 4 byte -2147483648 to 2147483648
long Integer 8 byte -263 to 263-1
float Real 4 byte 32-bit IEEE 754
double Real 8 byte 64-bit IEEE 754
boolean Boolean (true/false) 1 bit true,false
char Character 2 byte 0 to 65535
The following example creates a variable of int type and store 100 into it.
int a=100;
System.out.println(a);
In java, if you try to store a value beyond the permitted range of datatype then its syntax error.
The following declaration gives syntax error.
byte b=130;
www.tarunsir.com
www.cinstitute.org.in
Connect me on linkedin
/ tarrunverrma
Connect me on instagram
/ the_ultimate_coding_stuff
Follow me on twitter
/ tarrunverrma
Join my telegram channel
t.me/tarunvermasir
#tarunsir #javatutorial #learnprogramming #coding #java #datatype
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: