SCJP Module-10 Question-4


 

SCJP Module-10 Question-4

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

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.

Answer:

(B)

 

Ads