Static | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Static

what is the difference between static and non-static variable? in java

22nd Dec 2017, 6:33 AM
sal sal
sal sal - avatar
4 Answers
22nd Dec 2017, 7:56 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
static variables can be accessed by static methods and non static variables can be called by non static methods.
22nd Dec 2017, 6:49 AM
Neil Bhowmik
Neil Bhowmik - avatar
+ 2
Static variables are initialize first and can be accessed by only other static methods and non static method are just vice versa
22nd Dec 2017, 8:03 AM
Nikhil Gaurav
Nikhil Gaurav - avatar
0
static is under the class. So it is use full to run code without class
22nd Dec 2017, 2:02 PM
karthik