/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
StringBuilder stringBuilder = new StringBuilder(); try { while(scanner.hasNextLine()) { stringBuilder.append(scanner.nextLine() + "\n"); } } finally { scanner.close(); } return stringBuilder.toString(); }