exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 145 discussion

Actual exam question from Oracle's 1z0-819
Question #: 145
Topic #: 1
[All 1z0-819 Questions]

Given the code fragment:



Which two actions, independently, enable the code to compile? (Choose two.)

  • A. Inserting:
    finally ( in.close(); )
  • B. Replacing the catch block with:
    catch (FileNotFoundException | Exception e) ( )
    finally ( in.close(); )
  • C. Adding throws FileNotFoundException declaration at the main() method
  • D. Replacing the catch block with:
    catch (Exception e) ( )
  • E. Replacing the catch block with:
    catch (Exception | IOException e) ( )
  • F. Adding throws IOException declaration at the main() method
Show Suggested Answer Hide Answer
Suggested Answer: DF 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
3 months, 4 weeks ago
The question is that AutoCloseable interface has void close() throws Exception. Legacy Closeable interface has close() throws IOException the answer is DF but why ?
upvoted 1 times
...
d7bb0b2
6 months, 1 week ago
Selected Answer: DF
Caht exception and throws IoExp in declaration compile
upvoted 1 times
...
Omnisumem
9 months, 1 week ago
Selected Answer: DF
Tested: D (catch (Exception e) {}) and F.
upvoted 2 times
...
Stavok
12 months ago
Selected Answer: DF
D & F Are correct TESTED
upvoted 1 times
...
KiraguJohn
1 year ago
D,F There is an auto-closeable resource that needs IOException to be either declared in the method or be added in the catch block, if you only use Exception on the catch you will be fine since it is the parent class for all Exceptions
upvoted 1 times
...
KiraguJohn
1 year ago
There is an auto-closeable resource that needs IOException to be either declared in the method or be added in the catch block
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago