请问怎么会提示错误呢?
package com.xuanxuan;
public class Actor extends Thread {
public void run() {
System.out.println(getName()+"是一个演员");
int count=0;
boolean keepRuning=true;
while(keepRuning) {
System.out.println(getName()+"登台演出"+(++count));
if(count==100) {
keepRuning=false;
}
if(count%10==0) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
System.out.println(getName()+"演出结束了");
}
class Actress implements Runnable{
public void run() {
System.out.println(Thread.currentThread().getName()+"是一个演员");
int count=0;
boolean keepRuning=true;
while(keepRuning) {
System.out.println(Thread.currentThread().getName()+"登台演出"+(++count));
if(count==100) {
keepRuning=false;
}
if(count%10==0) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
System.out.println(Thread.currentThread().getName()+"演出结束了");
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Thread actor=new Actor();
actor.setName("先生");
Thread actressThread=new Thread(new Actress(),"女士");
actor.start();
actressThread.start();
}
}