Difference between static variable and non-static variable (instance variable)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Difference between static variable and non-static variable (instance variable)?

Static variable:- ( eg static int a=3) which is accessible in both static and non static block or method. non Static variable:- (eg int a=3) which is can't be accessed in static block or method.

9th Jan 2017, 4:00 PM
Annapoorani.H
Annapoorani.H - avatar
2 Answers
+ 4
static belongs to the class and non static belongs to objects created from the class
9th Jan 2017, 4:01 PM
Igor Busquets
Igor Busquets - avatar
0
igor- u mean static variable belong to class and non stati variable belong object
9th Jan 2017, 4:24 PM
Annapoorani.H
Annapoorani.H - avatar