60 525
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #20638 in Java | JSP | JSF for nohra

Question #20638

When we open a file for appending and the file already exists
A) There is a compiler error
B) There is a runtime error
C) The file contents will be overwritten
D) We will be adding data at the end of the file
Expert's answer
this code appends "row" to a file. parameter "true" in "FileWriter(fileName, append)" constructor provides appending to existing file. if file does not exists, it creates this file.

public void writeIn(File file) throws IOException, ClassNotFoundException
{
String row="row";

PrintWriter out1 = new PrintWriter(new BufferedWriter(new FileWriter(file,true)));
&
out1.println(row);
out1.close();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions