📄 exceptioninherit2.java
字号:
//ExceptionInherit2.java
class MyException2 extends Exception
{
private int i;
public MyException2()
{
}
public MyException2(String message)
{
super(message);
}
public MyException2(String message, int x)
{
super(message);
i = x;
}
public int value()
{
return i;
}
}
public class ExceptionInherit2
{
public static void f() throws MyException2
{
System.out.println("Throwing MyException2");
throw new MyException2("the third constructor!!!", 4);
}
public static void main(String[] args)
{
try
{
f();
}
catch(MyException2 e)
{
System.out.println("e.value()=" + e.value());
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -