Java variable is nothing but a named memory allocation which may vary at the time of execution.A variable assigns a value.
For example, int x=20;
Here x is a variable and the value 20 is assigned to x which is also known as variable initialization.
Basically Java supports three types of variables, such as :
A variable that is declared inside the method is called local variable.
A variable that is declared inside the class but outside the method is called instance variable .
A variable that is declared by the keyword static is called static variable. It cannot be local.
class Demo { int x=30; //instance variable int y=200; //static variable void get() { int z=50; //local variable `} }
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc