It was replaced with the new discount.out
created for this run of the program.
Sometimes you want to run a program several times and put the output of all the runs into a single file. For example, say that you want the discounted price of several items to be saved in one file. Here is how to do this:
C:\users\default\JavaLessons>java Discount > discount.out 100 10 C:\users\default\JavaLessons>java Discount >> discount.out 200 20 C:\users\default\JavaLessons>java Discount >> discount.out 47 15 C:\users\default\JavaLessons>
The double "greater than" signs >>
mean to add the new output to the end of the file
discount.out
.
This is called contatenation of the output to a file.
Here is what the file now looks like:
C:\users\default\JavaLessons>type discount.out Enter list price in cents: List price:100 Enter discount in percent: Discount:10 Discount Price: 90 Enter list price in cents: List price:200 Enter discount in percent: Discount:20 Discount Price: 160 Enter list price in cents: List price:47 Enter discount in percent: Discount:15 Discount Price: 40 C:\users\default\JavaLessons>