62,635
社区成员




public class Test_4 {
public static void main(String[] args) {
System.out.println(test());
}
public static int test() {
int j = 0;
try {
j = 1;
System.out.println("try:" + j);
return j;
}catch (Exception e) {
// TODO: handle exception
}finally {
j = 2;
System.out.println("finally:" + j);
}
return j;
}
}
public static void main(String[] args) {
Person p = new Person();
Person p1 = testPerson(p);
System.out.println(p1.name);
}
public static Person testPerson(Person p) {
try {
p.name = "try";
return p;
}catch (Exception e) {
}finally {
p.name = "finally";
}
p.name = "last";
return p;
}
}
class Person {
String name;
Person() {
}
j = 1;
System.out.println("try:" + j);
j = 2;
System.out.println("finally:" + j);
return j;