class MyException extends Exception
{
public MyException()
{
}
public MyException(String s)
{
super(s);
}
}
class abnormity14
{
public String grade(int score)throws MyException
{
if(score>=0&&score<=100)
{
return "正常";
}
else
{
throw new MyException("错误输入");
}
}
}
public class abnormity15
{
public static void main(String args[])
{
abnormity14 ab=new abnormity14();
try
{
String s=ab.grade(68);
System.out.println(s);
}
catch(MyException e)
{
System.out.println("异常信息为:"+e.getMessage());
}
}
}
这段程序怎么也运行时弹出一个奇怪的窗口咯,呵呵,刚入门,不太懂哦。
{
public MyException()
{
}
public MyException(String s)
{
super(s);
}
}
class abnormity14
{
public String grade(int score)throws MyException
{
if(score>=0&&score<=100)
{
return "正常";
}
else
{
throw new MyException("错误输入");
}
}
}
public class abnormity15
{
public static void main(String args[])
{
abnormity14 ab=new abnormity14();
try
{
String s=ab.grade(68);
System.out.println(s);
}
catch(MyException e)
{
System.out.println("异常信息为:"+e.getMessage());
}
}
}
这段程序怎么也运行时弹出一个奇怪的窗口咯,呵呵,刚入门,不太懂哦。
{
public MyException()
{ }
public MyException(String s)
{
super(s);
}
}
class abnormity14
{
public String grade(int score)throws MyException
{
if(score>=0&&score <=100)
{
return "正常";
}
else
{
throw new MyException("错误输入");
}
}
}
class abnormity15
{
public static void main(String args[])
{
abnormity14 ab=new abnormity14();
try
{
String s=ab.grade(-100);
System.out.println(s);
}
catch(MyException e)
{
System.out.println("异常信息为:"+e.getMessage());
}
}
}