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.
I'm not sure if I approve of this interruption. But this tiny ad checks out:
global solutions you can do in your home or backyard