throws IOException什么意思?public class Abs{public static void main(String arges[ ])throws IOException{int x=-4;if (x

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/12 23:35:03
throws IOException什么意思?public class Abs{public static void main(String arges[ ])throws IOException{int x=-4;if (x

throws IOException什么意思?public class Abs{public static void main(String arges[ ])throws IOException{int x=-4;if (x
throws IOException什么意思?
public class Abs
{
public static void main(String arges[ ])throws IOException
{
int x=-4;
if (x

throws IOException什么意思?public class Abs{public static void main(String arges[ ])throws IOException{int x=-4;if (x
可以去掉throws IOException 因为主方法里
没有会导致IOException的语句吧
throws IOException 不是跟try catch一起用的
当方法里一个语句产生了IOException
如果你用的try catch 那么这个异常是在这个方法中被捕获
如果 你用的throws IOException 那么可以不写try catch语句
这个异常被抛到方法外 在这个方法外被捕获