Friday, September 4, 2009

SCJP Questions

The file "file.txt" exists on the file system and contsins ASCII text. Given:
1 try {
2 File f = new File("file.txt");
3 OutputStream out = new FileOutputStream(f, true);
4 }
5 catch (IOException) {} What is the result?
A. The code does not compile.
B. The code runs and no change is made to the file.
C. The code runs and sets the length of the file to 0.
D. An exception is thrown because the file is not closed.
E. The code runs and deletes the file from the file system.
Answer: A

0 comments:

Post a Comment

 

About

Site Info

Information Source

Academy of JAVA by Rajesh Rolen Copyright © 2009 Community is Developed by Rajesh Kumar Rolen WebSite

/* tracking code by yahoo login */