Java and Android software development [Part-23] :: Data type and variables And Variable Practical

in life •  7 years ago  (edited)

Today we will know what the data type and variables are?
Let's first know about variables.

X = 10

X = 20

Y = 15.5

Z = 100

What is the variable?
The above mentioned x = 10 or y = 15.5 or z = 100 here x, y and z are variables but we have understood that there are 10 in the X but the computer will not understand because the computer has to say that this type of 10 data is any type of data. The computer can understand that the integer type of the data int is called integer

Int x = 10;

Int x = 20;

Float Y = 15.2;

Int Z = 100;

We will learn later that we have many rules to write this variable.

What is the data type?
Int x = 10;

Int x = 20;

Float Y = 15.2;

Int Z = 100;

Here we int that means that this is a whole number that says this int or float is the data type. There are eight types of primitive data types in Java. Int long sort byte boolean char float double more non primitive data type and we'll all know slowly. Up to this

Today we will know the 3 Variable Practices in Java.
First look at the code below

Public class Variable {
Static int b = 10;
Int c = 10;

Public static void main {String args []) {
Int a = 10;
System.out.println (a);
System.out.println (b);
Variable ob = new variable ();
System.out.println (ob.c);
}
}
Instance variable:
We see at the number 3 above the line it's static int b = 10; This is static or class variable.
It is in the class and out of the method. But static is written initially class is the variable and the method is
Maybe everyone understands.

Static or Class variable:
We are looking at the number 2 above the int c = 10; This is the instance variable. It is outside of class and outside the method. Here square is the variable and the method is Main. Everyone understands.

Local Variable:
We are looking at the number 5 above the int a = 10; This is local variable. It is in the method. Here is the method main. Everyone understands

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

You lost me at
X = 10

X = 20

@farmerfausto anythink wrong?