-2
下面這段代碼的輸出是「Test Passed」;有人可以向我解釋爲什麼?將finally賦值給變量
public class Test {
public static void main(String args[]) {
System.out.println(new Test().print());
}
protected StringBuilder print() {
StringBuilder builder = new StringBuilder();
try {
builder.append("Test ");
return builder.append("Passed!!!");
} finally {
builder = null;
}
}
請使用代碼格式。 –