Java OCA OCP Practice Question 2134

Question

Which can fill in the blank in this code?.

Properties props = new Properties(); 
props.___("x"); 
A.   get
B.   getProperty
C.   Both of the above
D.   Neither of the above


C.

Note

A Properties object implements Map.

This makes the get() method available.

Properties also defined a getProperty() method.

Therefore, both methods can fill in the blank, and Option C is correct.




PreviousNext

Related