黑马程序员技术交流社区
标题:
大神帮看下哪里出错了呀..
[打印本页]
作者:
Arron
时间:
2015-10-7 00:27
标题:
大神帮看下哪里出错了呀..
class LanPinException extends Exception
{
LanPinException(String message)
{
super(message);
}
}
class MaoYanException extends Exception
{
MaoYanException(String message)
{
super(message);
}
}
class NoPlanException extends Exception
{
NoPlanException(String msg)
{
super(massage);
}
}
class Computer
{ private int state=3;
public void run()throws LanPinExceptin,MaoYanException
{
if(state=2)
throw new LanPinException("电脑蓝屏");
if(state=3)
throw new MaoYanException("电脑冒烟");
System.out.println("电脑运行");
}
public void reset()
{
state=1;
System.out.println("电脑重启");
}
}
class Teacher
{
private String name;
private Computer cop;
Teacher(String name)
{
this.name=name;
cop=new Computer();
public void jiangke()throws NoPlanException
{
try
{
cop.run();
}
catch (LanPinException e)
{
cop.reset();
}
catch (MaoYanException e)
test();
{
throw new NoPlanException("课时无法继续"+e.getMassage());
}
System.out.println("讲课");
作者:
ljd19930325
时间:
2015-10-7 01:35
请原谅我看不懂,但是看出一点错误
if(state=2)
throw new LanPinException("电脑蓝屏");
if(state=3)
throw new MaoYanException("电脑冒烟");
if判断里面应该是==号吧
System.out.println("电脑运行");
if判断里面应该是==号吧
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2