Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to add characters to EOF?

Posted on 2004-10-04
3
Medium Priority
?
218 Views
Last Modified: 2010-03-31
If I have a file named book.java

and it contains:

book1
book2

now I want to add book3 to make it:

book1
book2
book3

how do I do that? How do I seek to the EOF?



0
Comment
Question by:izomax
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 12222635
PrintWriter out = new PrintWriter(new FileWriter("book.java", true));
out.println("book3");
out.close();
0
 

Author Comment

by:izomax
ID: 12222651
Is the usage of out.println("book3"); same as system.out.println?

Can I use:

out.println( variable + " added ");

Thanks!
0
 
LVL 92

Expert Comment

by:objects
ID: 12222664
yes
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question