Wednesday, August 11, 2010

Files: ReadingFor.java


Courtesy of SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065) (9780071591065)
Chapter 6, Question 10











And given that myfile.txt contains the following two lines of data:
 
ab
cd

What is the result?

Compiler Failure.  You need to call flush() only when you’re writing data. Readers don’t have flush() methods. If not for the call to flush() the output would be

ab
cd

No comments:

Post a Comment