1Z0-805 · Question #67
The current working directory is named finance. Which two code fragments allow you to write the salary.dat file if it does not exist under "finance\payroll"?
The correct answer is B. public static void setFileContent (String[] s) throws IOException { path p=paths.get ("payroll\\salary.dat"); D. public static void setFileContent (String[] s) throws IOException { File file= new File ("payroll\\salary.dat"). The problem in this scenario is how to construct a system-dependent filename from the string "payroll\\salary.dat". Oracle 1Z0-805 Exam Regarding File-paths: 1- A file can have many relative paths.2- Canonical paths are absolute paths.3- An absolute path is not necessarily a…
Question
The current working directory is named finance. Which two code fragments allow you to write the salary.dat file if it does not exist under "finance\payroll"?
Options
- Apublic static void setFileContent (String[] s) throws IOException { path p=paths.get("payroll\salary.dat");
- Bpublic static void setFileContent (String[] s) throws IOException { path p=paths.get ("payroll\salary.dat");
- Cpublic static void setFileContent (String[] s) throws IOException { File file= new file ("payroll\salary.dat").
- Dpublic static void setFileContent (String[] s) throws IOException { File file= new File ("payroll\salary.dat").
- Epublic static void setFileContent (String[] s) throws IOException { File file=new File ("payroll\salary.dat").
How the community answered
(58 responses)- A10% (6)
- B83% (48)
- C3% (2)
- E3% (2)
Explanation
The problem in this scenario is how to construct a system-dependent filename from the string "payroll\salary.dat". Oracle 1Z0-805 Exam Regarding File-paths: 1- A file can have many relative paths.2- Canonical paths are absolute paths.3- An absolute path is not necessarily a canonical path! This holds trueespecially under Unix, which support symbolic links. Under Windows, anabsolute path is usually a canonical path. B:The absolute path can include symbolic links. Here we ignore them with NOFOLLOW_LINKS D: The File.getCanonicalFile Method creates a new instance of a File object representing the file located at the absolute path of the current File object. All '.' and '..' references will be resolved.
Topics
Community Discussion
No community discussion yet for this question.