exam questions

Exam 1z0-809 All Questions

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

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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
MPignaProTech
2 weeks, 3 days ago
Selected Answer: C
a non existing propertie retuns null
upvoted 1 times
...
steefaand
10 months, 1 week 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, 9 months ago
Correct answer is C. Tested.
upvoted 1 times
...
Ohayou
2 years, 9 months ago
C. but more Correct answer is : "Good day!" Test null
upvoted 1 times
...
WilsonKKerll
2 years, 9 months ago
C. tested
upvoted 1 times
...
PontPont
3 years, 6 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago