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

 
 

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

Related Tags for SCJP Module-10 Question-2:


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.