Page 1 of 1
About Question enthuware.ocpjp.v8.2.1342 :
Posted: Sun May 21, 2017 8:47 pm
by lenalena
I answered "javac AssertTest.java" and it marked it wrong???
JPG of screenshot attached...
Re: About Question enthuware.ocpjp.v8.2.1342 :
Posted: Sun May 21, 2017 9:41 pm
by admin
Your answer seems to have an extra space between javac and AssertTest. Of course, it is correct but the engine is not able match it with the answers specified as correct. It is a limitation of the engine.
Paul.
Re: About Question enthuware.ocpjp.v8.2.1342 :
Posted: Mon Nov 20, 2017 11:44 am
by phusztek
Hi,
Based on this:
From Java 1.5 onwards, assert is treated as a keyword...
Why this one is correct?

- 2017-11-20 17_41_51.jpg (2.89 KiB) Viewed 4874 times
Thanks!
Re: About Question enthuware.ocpjp.v8.2.1342 :
Posted: Mon Nov 20, 2017 10:38 pm
by admin
You forgot to read the last part of the explanation that you have quoted, "From Java 1.5 onwards, assert is treated as a keyword by default.
The detailed explanation explains this point further.
Re: About Question enthuware.ocpjp.v8.2.1342 :
Posted: Thu Mar 22, 2018 11:23 am
by Wesley
Since it's a class for testing asserts I enabled Asserts and therefore got it wrong. I thought the point of the question was to test enabling asserts. Am I missing something?
I put: javac -ea AssertTest.java
Re: About Question enthuware.ocpjp.v8.2.1342 :
Posted: Thu Mar 22, 2018 8:55 pm
by admin
Wesley wrote:Since it's a class for testing asserts I enabled Asserts and therefore got it wrong. I thought the point of the question was to test enabling asserts. Am I missing something?
I put: javac -ea AssertTest.java
You need to read the question properly. It is asking about compilation and not execution. -ea flag is applicable only while executing a program and not while compiling it.
Re: About Question enthuware.ocpjp.v8.2.1342 :
Posted: Thu Mar 22, 2018 9:54 pm
by Wesley
Aaaah my bad. Thanks! That's what I get for always using an IDE.