- interface A
- {
- public void show();
- }
- class AException extends Exception
- {
- AException(String msg){
- super(msg);
- }
- }
- class Fu
- {
- private void show(){
- System.out.println("xxx");
- }
- }
- class Zi extends Fu implements A
- {
- public void show() throws AException{
- throw new AException("奇怪,异常一直不抛....");
- }
- }
- class ExceptionDemo2
- {
- public static void main(String[] args)
- {
- try{
- new Zi().show();
- }catch(AException e){
- System.out.println(e.getMessage());
- }
- }
- }
复制代码 |
|