public class XX {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
new Exception();
//new Exception();
} catch(Exception e)
{
System.out.println("Caught in main()");
}
System.out.println("nothing");
}
}
结果是:nothing
public class YY {
public static void main(String[] args) throws Exception {
try {
throw new Exception();
}catch(Exception e){
System.out.println("Caught in main()");
}
System.out.println("nothing");
}
}
结果是:
Caught in main()
nothing