Hello,
I just have this question.
say if i have a
java program like this.
class a{
int x;
public static void main(
String ar[]) {
int y;
System.out.print(x);
System.out.print(y);
}
}
This gives only one error saying it is not possible to refer non-static variable inside a static method.
But if you change the print lines like this.
class a{
int x;
public static void main(String ar[]) {
int y;
System.out.print(y);
System.out.print(x);
}
}
It gives 2 errors saying non static refernece and variable y not initialized.
Could you please explain the difference.
Thank you