📄 trytest.java
字号:
//================== TryTest.java ===================
public class TryTest
{
public static void main(String args[])
{
int a;
String s="abc";
try
{
a=Integer.parseInt("123");
System.out.println("a= "+a);
a=Integer.parseInt(s);
}
catch (NumberFormatException e)
{
System.out.println("错误 " + e.toString());
//返回throwable异常对象的一个简单描述
System.out.println("字符串: " +s + " 不能转换成整数!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -