📄 exceptiondemo.java
字号:
class ExceptionDemo
{
public int Result(int i) throws Exception
{
if(i<0)
throw new Less0Exception("result is:"+i);
if(i>100)
throw new More100Exception("result is:"+i);
int j=i;
return j;
}
class Less0Exception extends Exception
{
public Less0Exception(String msg)
{
super(msg);
}
}
class More100Exception extends Exception
{
public More100Exception(String msg)
{
super(msg);
}
}
}
class Test
{
public static void main(String args[]) throws Exception
{
ExceptionDemo t=new ExceptionDemo();
t.Result(150);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -