En este programa, la tercera cadena nunca se imprime. ¿Por qué?¿por qué un PrintWriter local interfiere con otro PrintWriter local?
(Este programa Java se ejecutan en Eclipse Indigo en Ubuntu 10.10.)
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();
}
}