Instance variable does mean you will get new value with every new object created of particular class rite? I tried it myself
eg:
class simpleinstcheck
{
static int i;
void incr()
{
System.out.println(i++);
}
public static void main(String args[])
{
simpleinstcheck sc= new simpleinstcheck();
sc.incr();
simpleinstcheck sc1= new simpleinstcheck();
sc1.incr();
simpleinstcheck sc2= new simpleinstcheck();
sc2.incr();
}
}
So the output is now 0,1,2.... So i got to ask u if its an instance variable is it denoted with static keyword??
coz wen i tried the same thing without staic keyword i got output:- 0,0,0
So wer the value of that variable remains fixed irrespective of objects created of that class is known as class variable.... please do correct me coz i googled a lot n m damn confused if m going rite way.... thanks