@@ -0,0 +1,1371 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0A%0Apackage readfromfile;%0A%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.util.Scanner;%0A%0A/**%0A *%0A * @author k8port%0A */%0Apublic class ReadFromFile %7B%0A%0A    /**%0A     * @param args the command line arguments%0A     */%0A    public static void main(String%5B%5D args) %7B%0A        %0A        Scanner jane = null;%0A        %0A        // gather input from file%0A        try %7B%0A            jane = new Scanner(new FileInputStream(%22chg.txt%22));%0A            String fileTxt = jane.nextLine();%0A            // change string from file%0A            int pos2 = fileTxt.indexOf(%22hate%22);%0A            String fileEnd = fileTxt.substring(pos2 + %22hate%22.length());%0A            String chgFileTxt = fileTxt.substring(0, pos2) + %22love%22 + fileEnd;%0A            // output result%0A            System.out.println(%22From file: %22);%0A            System.out.println(%22The line of text to be changed is: %22);%0A            System.out.println(fileTxt);%0A            System.out.println(%22I have rephrased the line to read: %22);%0A            System.out.println(chgFileTxt);%0A            %0A        %7D catch (FileNotFoundException e) %7B%0A            System.out.println(%22File not found.%22);%0A            System.exit(0);%0A        %7D%0A    %7D%0A%7D%0A

Create ReadFromFile.java