Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Output Help
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
IntelMaster




PostPosted: Fri Jun 04, 2010 9:38 pm   Post subject: Output Help

How do you write to a previously created text file?
Sponsor
Sponsor
Sponsor
sponsor
Unnamed.t




PostPosted: Fri Jun 04, 2010 10:13 pm   Post subject: Re: Output Help

OUTPUT

Use the PrintWriter method from java.io.PrintWriter class

Java:

PrintWriter out = new PrintWriter (new FileWriter ("Filename.txt"));



This can be used to output text to your file. Once again check java class libraries for methods e.g. out.println ();/out.print ();

OR

Use the BufferedWriter method from java.io.BufferedWriter class

Java:

BufferedWriter out = new BufferedWriter (new FileWriter ("Filename.txt"));



Check the different types of inputs that can be performed by using Help Reference of the Java class libraries (can be found on the sun microsystems java site)

Website for class libraries: http://java.sun.com/j2se/1.5.0/docs/api/
Unnamed.t




PostPosted: Fri Jun 04, 2010 10:16 pm   Post subject: Re: Output Help

And just to add, I encourage that you seek help from the friendly compsci community, but I advise you to check tutorials and other topics in the forum to look for answers instead of just making a whole new thread for a simple question. BTW I said this especially because the thread before yours happened to have helpful information on what you are looking for as well.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: