Can you help me on question of OCA / OCP Java SE 8 Programmer Practice Tests by Scott Selikoff and Jeanne Boyarsky.
Chapter 22 question no 8
Given this properties file used to load the Properties object props and this code
snippet, what is the output?
19: System.out.print(" ");
now to options:
B. bag null
C. bag ?
D. This code throws a runtime exception on line 20.
here answer b from the book but it should be d as it can not find the correct key .So please give your review ?
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns null if the property is not found.
Thanks for solving and clear my doubts. Generally, I was confused between properties getProperty() and Resourcebundle getString() method. As one throw exception when not found a proper key while another print null.Thanks for it.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database