public class StaticTest
{
private int count=0;
public static void main(String args[])
{
StaticTest a=new StaticTest();
a.count++; //compiler error: non-static variable count cannot be referenced from a static context
System.out.print("ab="+count);
}
}
No comments:
Post a Comment