inside the main method you have defined a static variable. static belongs to class. like the other variable i you have defined is fine.
remove static modifier from the i inside main method and it would be ok.
like this:
public static void main(
String[] arg){
int i = 20;
System.out.println("i is :"+i);
System.out.println("static i is :"+MyClass.i);
Originally posted by sonir shah:
I tried running the program, but it is not compiling..
It shows an error: saying that illegal start of an expression..
cannot understand the error..need explainations..
Sonir