package shubh;
class thread5
{
static class a7 extends Thread
{
public void run()
{
for(int i=0;i<=10;i++)
{
System.out.println(i);
}
}
}
static class a8 implements Runnable
{
public void run()
{
for(int i=21;i<=30;i++)
{
System.out.println(i);
}
}
}
public static void main(String arg[])
{
a7 a=new a7();
a.start();
a8 b=new a8();
Thread th=new Thread(b);
th.start();
for(int i=40;i<=50;i++)
{
System.out.println(i);
}
}
}
when i remove static keyword from the 2 nested classes it is giving error non static variable cannot be referenced from a static context can anyone explain me the meaning of this error or why it is necessary to give nested class as static