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

 
 

Share on Google+Share on Google+
SCJP Module-10 Question-3
Posted on: July 16, 2010 at 12:00 AM
Advertisement
The Sample example given below will test your understanding of creating a file using File class on the local disk.

Suppose you have a test.txt file at C:\work\satya directory and you want to access this file from the java code given below:

1    import java.io.*;
2    public class Test {
3    public static void main(String[] args) throws Exception {
4    File file = new File("Place code here");
5    System.out.println(file.exists());
}}

So what statement should be placed at line no 4 for accessing test.txt file. Assume you are using widow platform. Choose the correct option?

(A) C:\work\satya\test.txt
(B) C:\\work\\satya\\test.txt 
(C) C://work//satya//test.txt
(D) C:/work/satya/test.txt

Answer:

(B)

Advertisement

Related Tags for SCJP Module-10 Question-3:


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