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
(B)
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.