Share on Google+Share on Google+

SCJP Module-10 Question-4

The sample code given below will test your understanding of File class their methods in Java.

Given a sample code:

1    public class Test {
2    public static void main(String argv[]) {
3    Test m = new Test();
4    m.findFile();

5    public void findFile() {
6    try {
7    new FileInputStream("Hello.txt");
8    } catch (FileNotFoundException e) {
9    System.out.println("file not found");

What operation does this code perform?

(A) Creates a file Hello.txt
(B) It will display output "file not found" 
(C) Compile time error.
(D) Raise run-time exception.





Posted on: July 16, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.