class StaticVar
{
static int count;
public void inc()
{
count++;
}
}
class Sixteen{
public static void main(String args[])
{
StaticVar obj1=new StaticVar();
StaticVar obj2=new StaticVar();
obj1.inc();
obj2.inc();
System.out.println("count: "+StaticVar.count);
System.out.println("count: "+StaticVar.count);
}
}
{
static int count;
public void inc()
{
count++;
}
}
class Sixteen{
public static void main(String args[])
{
StaticVar obj1=new StaticVar();
StaticVar obj2=new StaticVar();
obj1.inc();
obj2.inc();
System.out.println("count: "+StaticVar.count);
System.out.println("count: "+StaticVar.count);
}
}
No comments:
Post a Comment