Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package StringSwapper;
- import java.io.*;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- try (PrintWriter pw = new PrintWriter(new File("output.txt"))) {
- pw.write("Hello, world! Good bye, world!");
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- Scanner sc = new Scanner(new FileInputStream(new File ("output.txt")));
- while (sc.hasNext()) {
- String temp = sc.next();
- System.out.println(temp);
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement