Home Tutorial Java Scjp Part10 SCJP Module-10 Question-4

 
 

SCJP Module-10 Question-4
Posted on: July 16, 2010 at 12:00 AM
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)

 

Related Tags for SCJP Module-10 Question-4:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.