Skip to content

Instantly share code, notes, and snippets.

@mquezada
Created March 17, 2014 15:14
Show Gist options
  • Save mquezada/9601105 to your computer and use it in GitHub Desktop.
Save mquezada/9601105 to your computer and use it in GitHub Desktop.
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
class IO_1 {
static public void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String line;
StringBuilder sb = new StringBuilder();
while((line = bf.readLine()) != null) { // una version mas corta de lo mismo
sb.append(line + "\n"); // guardamos cada linea en el StringBuilder, mas un salto de linea
}
System.out.println(sb.toString()); // imprimimos todo junto al final
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment