macosxnerd101, on 02 March 2010 - 10:17 PM, said:
macosxnerd101, on 02 March 2010 - 10:27 PM, said:
Just create three File objects and wrap your three OutputStreams, one around each File.
File one = new File("one.dat");
File two = new File("two");
File three = new File("three");
try{
one.createNewFile();
two.createNewFile();
three.createNewFile();
}
catch(Exception e){
System.out.println("Creation failed");
System.exit(0);
}
You should probably create File objects first and use the File createNewFile() method to create the Files on the hard drive, as I showed in one of my earlier posts. Note that the File constructor accepts a String denoting the path of the File (or simply the name if it is local to the folder).
For more information on the File class, check out the API:
http://java.sun.com/...va/io/File.html
You mean I need to replace
outDat.writeUTF(joke[i]); outTxt.writeUTF(joke[i]); outObj.writeUTF(joke[i]);
with
one.createNewFile(); two.createNewFile(); three.createNewFile();

New Topic/Question
Reply




MultiQuote






|