千峰JAVA第26天作业

在千峰第26天
“前进,前进,再前进”
中国加油,武汉加油,千峰加油,我自己加油。
Q11
1、
Throwable
Error
不处理
Exception
2、
Ⅰ已检查、必须
Ⅱ运行时、可处理或可不、
3、
① throw new NullPointerException();
②throw new ClassCastException(“类型转换出错”);
4、
①n=1
main 1
ma1
mb1
Catch EOFException
In finally
main 2
②n=2
main 1
ma1
mb1
Catch IOException
In finally
main 2
③n=3
main 1
ma1
mb1
Catch SQLException
In finally
main 2
④n=4
main 1
ma1
mb1
Catch Exception
In finally
main 2
⑤n=5
main 1
ma1
mb1
ma2
In finally
main 2
7、

class MyException{}
public class TestException {
	public static void main(String[] args) {
		ma();
	}
	public static int ma(){
		try{
			m();
		}catch(ArithmeticException e){
			System.out.println("ArithmeticException");
		}catch(Exception e){
			System.out.println("Exception");
		}finally{
			return 100;
		}	
	}
	public static void m(){
		throw new ArithmeticException();
	}
}

9、
A
11、

ma1
ma2 1
In Finally

ma1
In Finally
13、
A
14
AB

发布了21 篇原创文章 · 获赞 0 · 访问量 1964

猜你喜欢

转载自blog.csdn.net/qq_40091389/article/details/104761639