问答题
写出下面程序的运行结果。
public class Class34
{
public static void main(String args[])
Hello h=new Hello();
Thread t=new Thread(h);
t. start();
}
}
class Hello implements Runnable
{
int i;
public void run()
{
while(true)
{
System.out.println("Hello" +i++);
if(i==5)break;
}
}
}
【参考答案】
输出结果为:
Hello0
Hello1
Hello2
Hello3
Hello4