A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© Arron 中级黑马   /  2015-10-7 00:27  /  267 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文


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("讲课");

1 个回复

倒序浏览
请原谅我看不懂,但是看出一点错误
if(state=2)
  throw new LanPinException("电脑蓝屏");
  if(state=3)
  throw new MaoYanException("电脑冒烟");
  if判断里面应该是==号吧
  System.out.println("电脑运行");
if判断里面应该是==号吧
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马