This program creates a file called 123.txt, appends new data to it if it already exists, and writes 150 randomly generated integers separated by spaces into the file using text I/O. It uses a PrintWriter to write to a FileOutputStream with the file 123.txt in append mode, and generates random integers between 0-150 in a for loop, printing each one with a space to the file. Any errors are caught and printed.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
43 views1 page
OOPJ1
This program creates a file called 123.txt, appends new data to it if it already exists, and writes 150 randomly generated integers separated by spaces into the file using text I/O. It uses a PrintWriter to write to a FileOutputStream with the file 123.txt in append mode, and generates random integers between 0-150 in a for loop, printing each one with a space to the file. Any errors are caught and printed.