About Question enthuware.ocpjp.v8.2.1342 :
Moderator: admin
-
- Posts: 56
- Joined: Tue Feb 21, 2017 4:24 pm
- Contact:
About Question enthuware.ocpjp.v8.2.1342 :
I answered "javac AssertTest.java" and it marked it wrong???
JPG of screenshot attached...
JPG of screenshot attached...
- Attachments
-
- assert.jpg (37.95 KiB) Viewed 4289 times
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1342 :
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.
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 6
- Joined: Tue Nov 22, 2016 11:04 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1342 :
Hi,
Based on this:
Based on this:
Why this one is correct? Thanks!From Java 1.5 onwards, assert is treated as a keyword...
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1342 :
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.
The detailed explanation explains this point further.
If you like our products and services, please help us by posting your review here.
-
- Posts: 11
- Joined: Sun Mar 18, 2018 9:08 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1342 :
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
I put: javac -ea AssertTest.java
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1342 :
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.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
If you like our products and services, please help us by posting your review here.
-
- Posts: 11
- Joined: Sun Mar 18, 2018 9:08 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1342 :
Aaaah my bad. Thanks! That's what I get for always using an IDE.
Who is online
Users browsing this forum: Bing [Bot] and 70 guests