fork download
  1. import java.io.*;
  2.  
  3. class Fichero3 {
  4.  
  5. public static void main(String[] args) {
  6. BufferedReader teclado;
  7. String x;
  8. inStream=new InputStreamReader(System.in);
  9. teclado = new BufferedReader(inStream);
  10.  
  11. File fSalida = new File("prueba.salida");
  12. try {
  13. String s;
  14.  
  15. while (!(s = teclado.readLine()).equals("final") ) {
  16. System.out.println(s);
  17.  
  18. System.out.println(s.getClass());
  19. }
  20.  
  21. inStream.close();
  22.  
  23. } catch (FileNotFoundException e) {
  24. System.err.println("Fichero. no encontrado");
  25.  
  26. } catch (IOException e) {
  27. System.err.println("Error de E/S");
  28. }
  29. System.out.println("He terminado");
  30. }
  31. }
Runtime error #stdin #stdout #stderr 0.05s 4386816KB
stdin
matarife
Linurillo
stdout
matarife
class java.lang.String
Linurillo
class java.lang.String
stderr
Exception in thread "main" java.lang.NullPointerException
	at Fichero3.main(Main.java:16)