The Question is as follows: Explain the difference between the output 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 believe the PrintWriter coverts the stream into Unicode and the DataOutStream converts higher level data items to sequence of bytes.
What more can be said?


LinkBack URL
About LinkBacks
Reply With Quote