class VeryImportantException extends Exception{
public String toString(){
return "A very important exception!";
}
}
class HoHumException extends Exception {
public String toString(){
return "A trivial exception";
}
}
public class Te{
void f() throws VeryImportantException{
throw new VeryImportantException();
}
void dispose() throws HoHumException{
throw new HoHumException ();
}
public static void main void main(String[] args)throws Exception{
Te te = new Te();
try{
te.f();
}finally{
te.dispose();
}
}
}
直接上代码了   - -   main下面老是有波浪线

解决方案 »

  1.   

    改成下面这样试试class VeryImportantException extends Exception{
        public String toString(){
            return "A very important exception!";
        }
    }
    class HoHumException extends Exception {
        public String toString(){
            return "A trivial exception";
        }
    }
    public class Te{
        void f() throws VeryImportantException{
            throw new VeryImportantException();
        }
        void dispose() throws HoHumException{
            throw new HoHumException ();
        }
        public static void main (String[] args)throws Exception{
            Te te = new Te();
            try{
                te.f();
            }finally{
                te.dispose();
            }
        }
    }
      

  2.   

    明显的代码错误public static void main void main(String[] args)
      

  3.   


    public static void main void main(String[] args)这个明显的错误
    改正:public static void main(String[] args)
      

  4.   

    public static void main void main(String[] args)throws Exception
    两个void main 啊
      

  5.   

    这个貌似在考验大家的仔细度,多了一个void main ,楼主写代码要仔细点哦。