class Computer
{
private int state = 1;//1代表正常运行
public void run()throws LanPingException,MaoYanException
{
if(state==2)
{
throw new LanPingException("蓝屏了!");
}
if(state==3)
{
throw new MaoYanException("冒烟了!");
}
System.out.println("电脑运行");
}
public void reset()
{
state = 1;
System.out.println("电脑重启");
}
}
class Teacher
{
private String name;
private Computer cmpt;
Teacher(String name)
{
this.name = name;
cmpt = new Computer();
}
class Computer
{
private int state = 1;
public void run()throws LanPingException,MaoYanException
{
if(state==2)
{
throw new LanPingException("蓝屏了!");
}
if(state==3)
{
throw new MaoYanException("冒烟了!");
}
System.out.println("电脑运行");
}
public void reset()
{
state = 1;
System.out.println("电脑重启");
}
}
class Teacher
{
private String name;
private Computer cmpt;
Teacher(String name)
{
this.name = name;
cmpt = new Computer();
}