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

 
 

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

 

Advertisement

Related Tags for SCJP Module-10 Question-4:


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.

Posted on: July 16, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com