Explain the difference between the outputs of the following two fragments of code for outputting an int i to a file:
i)
PrintWriter outfile = new PrintWriter(new FileWriter("ints.txt"));
outfile.print(i);
ii)
DataOutputStream out = new DataOutputStream(new FileOutputStream("ints.dat"));
out.writeInt(i);
I think the Printer writer takes a string and tranforms it into a stream of unicode characters, whereas dataoutput stream converts the data items to sequence of bytes.
What more would you add?