title: How to copy a text file, and print out the original and copied file in Java
body: <p>I'm doing a program that needs to take a text file (test.txt) and make a copy of it and print it out.  So far I am only able to print out the original file.  I have searched for a way of doing this but there doesn't seem to be any help that I can understand, I am very new to java.  I am at least looking for guidance, not just the full answer.</p>
  
  <p>my code so far...</p>
  
  <pre><code>import java.io.*;
  
  public class Copy{
      public static void main(String [] args){
          try{
              FileInputStream fis = new FileInputStream("test.txt");
  
              InputStreamReader isr = new InputStreamReader(fis);
              BufferedReader br = new BufferedReader(isr);
              File a = new File("test.txt");
              FileReader fr = new FileReader(a);
  
              File b = new File("Copied.txt");
              FileWriter fw = new FileWriter(b);
  
              while(true){
                  String line = br.readLine();
                  if(line != null){
                      System.out.println(line);
  
                  } else{
  
                      br.close();
                      break;
                  } 
              }
          } catch(FileNotFoundException e){
              System.out.println("Error: " + e.getMessage());
          } catch(IOException e){
              System.out.println("Error: " + e.getMessage()); 
          }
      }
  }
  </code></pre>
  
  <p>Again any bit of help will be greatly appreciated since I am trying to learn this.  Thank you</p>