Share on Google+Share on Google+

SCJP Module-10 Question-1

Advertisement
The given program will test your understanding of File class and its package in Java.

Given a sample code:

1    // place code here

2    public class Test {
3    public static void main(String[] args) throws Exception {
4    File file = new File("test.txt");
5    System.out.println(file.exists());
}}

What code should be placed at line no 1 for the successfully execution of above code?
Choose correct options?

(A) import java.io.*;
(B) import java.io.File; 
(C) import.java.util.*;
(D) import java.lang;

Answer:

(A) or (B)

Advertisements

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.