class tq{
protected double x;
protected static int n;}
class ts extends tq{}
public class
Test extends ts
{
private
String str;
Test()
{
System.out.println("hello");
str="Private variable";
}
public static void testNest()
{
class nested{
void display()
{
// System.out.println(str);
System.out.println(x);
System.out.println(n);
}
};
new nested().display();
}
public static void main(String[] a)
{
Test t=new Test();
t.testNest();
}
}
Here I am getting erroe can't make static reference to non static variable double x in void display()
But in Khalid Mughal on page 239 an example is given and on line 19 they have access non static variable from super class in to static local call.
Please tell me where I am making mistake?