package defaultPackage;

import java.util.*;
import java.io.*;

public class UsingFiles {

	public static void main(String[] args) throws FileNotFoundException
	{
		System.out.println("Read a file line by line");
//		File f = new File("/home/alexis/Downloads/myfile.txt");
//		Scanner in = new Scanner(f);
		Scanner in = new Scanner(new File("/home/alexis/Downloads/myfile.txt"));
		while (in.hasNextLine())
		{
			String line = in.nextLine();
			System.out.println(line);
		}

	}

}

@@ -163,52 +163,231 @@
 %0A%09%09S
-ystem.out.println(%22Read a file line by line%22
+tring fileName = %22/home/alexis/Downloads/myfile.txt%22;%0A%09%09System.out.println(%22Read a file line by line%22);%0A%09%09PrintWriter out = new PrintWriter(fileName);%0A%09%09out.println(%22A new line%22);%0A%09%09out.println(%22A new line 2%22);%0A%09%09out.close(
 );%0A/
@@ -518,43 +518,16 @@
 ile(
-%22/home/alexis/Downloads/myfile.txt%22
+fileName
 ));%0A

write to file