public static void main(String[] args){
NoBindingTest n = new NoBindingTest();
try{
n.s();
} catch (Exception e){
System.out.println("s-main()");
}
try{
n.t();
} catch (Exception e){
System.out.println("t-main()");
}
try{
n.t2();
} catch (Exception e){
System.out.println("t2-main()");
}
}
public void s(){
try{
int s = Integer.parseInt("s");
System.out.println(s);
} catch (NumberFormatException e){
System.out.println("s()");
}
}
public void t(){
int t = Integer.parseInt("t");
System.out.println(t);
}
public void t2() throws NumberFormatException{
int t2 = Integer.parseInt("t2");
System.out.println(t2);
}
结果: