輸出即將通過測試!如何建設者返回時,它被設置爲null在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;
}
}
}
是的,無論是否存在異常,最後都會執行。也許你在混淆catch catch – demongolem
你問這個就像7個小時前....這裏已經回答了 –