Question: I am tasked on writing a Java program that converts a text file into a binary file (for this, I'm assuming a .dat file will
I am tasked on writing a Java program that converts a text file into a binary file (for this, I'm assuming a .dat file will do). I figure that the best way to accomplish this is to simply copy the contents from the text file, and write them to the .dat file. The .dat file would already be available to write to in the directory... no need for the program to create a new file. We're not supposed to use Scanner, but I'm assuming we're expected to use BufferedWriter for efficiency.
I can figure out how to put together a program that writes data to a .dat file that's already given in the program via output.writeUTF, but how would I configure a program that takes the text from a text file and puts it into a .dat file?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
