About Question enthuware.ocpjp.i.v11.2.3142 :
Posted: Tue Jul 14, 2020 10:18 pm
Test -1
83
-----------
Given: public static void main(String[] args){ try(FileInputStream fis = new FileInputStream("c:\\temp\\test.text")){ System.out.println(fis); } //line 1 }
Which of the following options can be inserted at //1 independent of each other to make the above code compile? Note that FileInputStream, try-with-resources, and multi-catch are NOT mentioned in the official exam objectives. However, we have seen questions in the exam that require knowledge on these topics. It is possible that these are questions are unscored i.e. their score doesn't count towards your final score. Since we have no way of knowing that, it is better to read up on these topics.
catch(IOException){ } ; This was specified as correct answer; but there is not identifier; like IOExceptio ioe;
This wont compile. Thats why i did not select this.
catch(IOException e){ } finally{ fis.close(); } -> This seems better option than the before one. But this option is wrong as per Enthuware.
83
-----------
Given: public static void main(String[] args){ try(FileInputStream fis = new FileInputStream("c:\\temp\\test.text")){ System.out.println(fis); } //line 1 }
Which of the following options can be inserted at //1 independent of each other to make the above code compile? Note that FileInputStream, try-with-resources, and multi-catch are NOT mentioned in the official exam objectives. However, we have seen questions in the exam that require knowledge on these topics. It is possible that these are questions are unscored i.e. their score doesn't count towards your final score. Since we have no way of knowing that, it is better to read up on these topics.
catch(IOException){ } ; This was specified as correct answer; but there is not identifier; like IOExceptio ioe;
This wont compile. Thats why i did not select this.
catch(IOException e){ } finally{ fis.close(); } -> This seems better option than the before one. But this option is wrong as per Enthuware.