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);
}
}
}
当我从 2 个嵌套类中删除 static 关键字时,它给出错误non static variable cannot be referenced from a static context谁能解释我这个错误的含义或为什么有必要将嵌套类作为静态