SCJP Module-10 Question-2


 

SCJP Module-10 Question-2

The sample example given below will test your understanding of File class of Java.

The sample example given below will test your understanding of File class of Java.

Given a sample code:

import java.io.File;

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

What will the result if it is compiled and run at first time?

(A) true
(B) false 
(C) Compile time error.
(D) Raise run-time exception.

Answer:

(B)

Ads