Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.68

Posted: Wed May 20, 2015 7:47 am
by pushpull
The second option looks like this:
It will print false only if it is executed as: java -DFLAG=false Testclass
And the class name is TestClass. So it's a bad answer mostly, because it just won't run.
The third option is (the correct):
It will print true if executed as: java -DFLAG=true TestClass
and the answer to this is
Boolean.valueOf() is case insensitive. So it will print true even if executed as: java -DFLAG=tRUe TestClass
But what does case sensitivity have with the answer? According to https://docs.oracle.com/javase/tutorial ... sprop.html
The other version of getProperty requires two String arguments: the first argument is the key to look up and the second argument is a default value to return if the key cannot be found or if it has no value.
and I think this is the most important information, because the value is being set in execution. So the default "false" won't be needed.

Re: About Question com.enthuware.ets.scjp.v6.2.68

Posted: Wed May 20, 2015 8:18 pm
by admin
1. Yes, in should say TestClass instead of Testclass. It is still a wrong option.
2. Explanation to Option 2 already talks about the getProperty method. It is quite straight forward, without much complication. Explanation to option 3 adds to that by giving you information about the case sensitivity of valueOf method. The option itself doesn't require this information. This is additional information that is important for the exam because there are questions in the exam that require you to know this.

Please remember that it is not book, so it is not possible to provide all the information with all the questions. But if you go through all the questions, you will see that everything that is important for the exam has been covered.

HTH,
Paul.