Oracle
1Z0-851 · Question #84
Given: 12. public class Commander { 13. public static void main(String[] args) { 14. String myProp = / insert code here / 15. System.out.println(myProp); 16. } 17. } and the command line: java…
The correct answer is D. System.getProperty("prop.custom"); E. System.getProperties().getProperty("prop.custom"). See the full explanation below for the reasoning.
Question
Given: 12. public class Commander { 13. public static void main(String[] args) { 14. String myProp = /* insert code here */ 15. System.out.println(myProp); 16. } 17. } and the command line: java -Dprop.custom=gobstopper Commander Which two, placed on line 13, will produce the output gobstopper? (Choose two.)
Options
- ASystem.load("prop.custom");
- BSystem.getenv("prop.custom");
- CSystem.property("prop.custom");
- DSystem.getProperty("prop.custom");
- ESystem.getProperties().getProperty("prop.custom");
How the community answered
(41 responses)- A2% (1)
- B12% (5)
- C5% (2)
- D80% (33)
Community Discussion
No community discussion yet for this question.