SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Originally posted by Jothi Shankar Kumar Sankararaj:
I got the reason as to why d is correct. If you replace the default block with an assert statement, then when you run the code with assertions disabled, it will give you a compiler error saying that the default block has got no return statement.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
When you say throw new AssertionError, you are actually returning something which will be caught by the JVM this cae. So you are not violating the rules for a method that requires a return.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Originally posted by Jothi Shankar Kumar Sankararaj:
I got the reason as to why d is correct. If you replace the default block with an assert statement, then when you run the code with assertions disabled, it will give you a compiler error saying that the default block has got no return statement.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |