Improper Use of BufferedReader?
What is happening is that I want to open "shellscript.txt" and insert it into a new document then open another file and insert it in the same document right after where I insert "shellscript.txt". Maybe I am going about this the wrong way but what is happening is where the data in "shellscript.txt" is supposed to go, a line containing this is save:"java.io.BufferedReader@11a698a". What does that mean and how can I fix this? Here is the code and it compiles and runs error free.
import java.io.*;
public class TextIO2 {
public static void main(String args[]) { // We want to let the user specify which file we should open// on the command-line. E.g., 'java TextIO TextIO.java'.
if (args.length != 1) {
System.err.println("File Does Not Exist");
System.exit(1);
} // We're going to read lines from 'input', which will be attached// to a text-file opened for reading.
BufferedReader input = null;
try {
FileReader file = new FileReader(args[0]); // Open the file.
input = new BufferedReader(file); // Tie 'input' to this file.
} catch (FileNotFoundException x) { // The file may not exist.
System.err.println("File not found: " + args[0]);
System.exit(2);
}
// Now we read the file, line by line, echoing each line to
// the terminal.
try {
String line;
BufferedReader shellscript = new BufferedReader(new FileReader("shellscript.txt"));
FileWriter MyFile = new FileWriter("abcde.txt");
PrintWriter outFile = new PrintWriter(MyFile, true);
outFile.print(shellscript);
System.out.println(shellscript); // Temp for debugging purposes
while ((line = input.readLine()) != null) {
System.out.println(line);// Temp for debugging purposes
outFile.println(line);
}
MyFile.close();
outFile.close();
} catch (IOException x) {
x.printStackTrace();
}
}
}

