Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-809 topic 1 question 18 discussion

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

Given the content of /resourses/Message.properties:
welcome1="Good day!"
and given the code fragment:
Properties prop = new Properties ();
FileInputStream fis = new FileInputStream ("/resources/Message.properties"); prop.load(fis);
System.out.println(prop.getProperty("welcome1"));
System.out.println(prop.getProperty("welcome2", "Test"));//line n1
System.out.println(prop.getProperty("welcome3"));
What is the result?

  • A. Good day! Test followed by an Exception stack trace
  • B. Good day! followed by an Exception stack trace
  • C. Good day! Test null
  • D. A compilation error occurs at line n1.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
steefaand
1 month, 3 weeks ago
Selected Answer: C
Answer is C as getProperty returns null if key is not found as opposed to getString in ResourceBundle which throws MissingResourceException if key is not found.
upvoted 1 times
...
r1muka5
1 year ago
Correct answer is C. Tested.
upvoted 1 times
...
Ohayou
2 years ago
C. but more Correct answer is : "Good day!" Test null
upvoted 1 times
...
WilsonKKerll
2 years, 1 month ago
C. tested
upvoted 1 times
...
PontPont
2 years, 9 months ago
answer is C
upvoted 4 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 ...