62,615
社区成员
发帖
与我相关
我的任务
分享
public static String fun(){
String s = "abc";
try{
throw new Exception();
} catch (Exception e) {
return s;
} finally{
s = "s";
}
}
public class Dummy2 {
public static void main(String[] args) {
String str = fun();
PrintUtil.print("return");
PrintUtil.print(str);
}
public static String fun(){
String s = "abc";
try{
throw new Exception();
} catch (Exception e) {
return fun2(s);
} finally{
s = "s";
PrintUtil.print("finally");
}
}
public static String fun2(String s){
PrintUtil.print("in fun2 s=" +s);
return s;
}
}
static String s = "abc";
public static String fun() {
try {
throw new Exception();
} catch (Exception e) {
System.out.println("return");
return s;
} finally {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("finally");
s = "s";
}
}
public static void main(String[] args) throws Exception {
Test T1 = new Test();
System.out.println(T1.s);
System.out.println(T1.fun());
System.out.println(T1.s);
}
public Map returnMap() {
try {
x.put("8", "8");
return x;
} finally {
// x = new HashMap <String, String>();
x.put("7", "7");
}
}
public String fun(){
String s = "abc";
try{
throw new Exception();
} catch (Exception e) {
return s;
} finally{
s = "s";
}
}
public String fun2(){
try{
throw new Exception();
} catch (Exception e) {
return "123";
} finally{
return "abc";
}
}