📄 trycatchtest.java
字号:
import java.io.*;
class TryCatchTest
{
public static void main(String argv[])
{
File file = new File("abc.txt");
int a[] = {1,2};
try
{
System.out.println(3/0);
}
catch(ArithmeticException e1)
{
System.out.print("3/0: " );
System.out.println("This is ArithmeticException");
}
try
{
System.out.println(a[2]);
}
catch(ArrayIndexOutOfBoundsException e2)
{
System.out.print("a[2] is out of Array: " );
System.out.println("This is ArrayIndexOutOfBoundsException");
}
try
{
BufferedReader input = new BufferedReader(new FileReader(file));
}
catch(FileNotFoundException e3)
{
System.out.print("abc.txt is not found: " );
System.out.println("This is FileNotFoundException");
}
catch(IOException e)
{
System.out.println("This is IOException");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -