?? exception5.java
字號:
//自定義異常
class OverFlowException extends Exception
{
OverFlowException()
{
System.out.println("此處數據有溢出,溢出類是OverFlowException");
}
}
public class Exception5
{
public static int x=100000;
public static int multi() throws OverFlowException
{
int aim;
aim=x*x*x;
if(aim>2.15E9 || aim<0)
throw new OverFlowException();
else
return x*x*x;
}
public static void main(String args[])
{
int y;
try
{
y= multi();
System.out.println("y="+y);
}
catch(OverFlowException e)
{
System.out.println(e);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -