A good answer might be:

Sure, because output.txt is a text file. Once it has been created it is a text file like any other.


Printing a Program's Output

One way to print the output of a program is to redirect its output to a text file (as in the previous page), then read the file into Notepad, then used Notepad's print command. Here is a Hello.java program that can be used with "copy-paste-save-and-run" to practice redirection.

class Hello
{
  public static void main ( String[] args )
  {
    System.out.println("Hello World");
  }
}

Here (again) is this program being used with output redirection:

C:\users\default\JavaLessons>javac Hello.java

  compiling: Hello.java

C:\users\default\JavaLessons>java Hello > output.txt

C:\users\default\JavaLessons>type output.txt
Hello World

C:\users\default\JavaLessons>

Of course, you will probably be in a different subdirectory when you do this.

QUESTION 9:

After the above commands have been executed, what happens to the file called output.txt in the subdirectory C:\Myfiles ?