在这个程序中,第三个字符串永远不会被打印出来。为什么?
(这个 Java 程序在 Ubuntu 10.10 上的 Eclipse Indigo 上运行。)
import java.io.PrintWriter;
public class Tester
{
static void nested()
{
PrintWriter object2 = new PrintWriter(System.out, true);
object2.println("second");
object2.close(); // delete this line to make all strings print
}
public static void main(String[] args)
{
PrintWriter object1 = new PrintWriter(System.out, true);
object1.println("first");
Tester.nested();
object1.println("third");
object1.close();
}
}