SCJP Module-10 Question-1


 

SCJP Module-10 Question-1

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

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)

Ads