Page 1 of 1

About Question enthuware.ocpjp.v8.2.1322 :

Posted: Thu Mar 24, 2016 2:44 am
by surzhin
"Assertions can be enabled or disabled through the command line at the time of execution of the program."
By using the switches, -ea and -da or -enableassertions or -disableassertion.

Assertions can be enabled or disabled through the command line at the time of starting of the program.

Can I change the mode after the program start?

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Thu Mar 24, 2016 10:00 am
by admin
The phrase "at the time of execution" is used in the same sense as "at the time of starting". It is like saying, "ok, execute the program now", which is same as, "ok, start the program now". It doesn't say, "during the execution", which is what you are referring to.
Anyway, I am updating the statement to make it more clear.
thank you!
Paul.

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Thu Jul 28, 2016 1:07 pm
by badbishop
Speaking of changes the assertions require, I think it should be mentioned what is meant by "change", otherwise the question is ambiguous. If I understand it right, it is introducing assert keyword in JDK 1.4.

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Fri Nov 04, 2016 8:38 am
by ja3ekja
I have a question about Test 2 80 question
Code written for JDK version 1.3 cannot be compiled under JDK version 1.4
what with backwards compatiblity?
Edit
All right there was no question:)
It is about NOT correct statement

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Fri Nov 04, 2016 9:12 am
by admin
ja3ekja wrote:I have a question about Test 2 80 question
Code written for JDK version 1.3 cannot be compiled under JDK version 1.4
what with backwards compatiblity?
Edit
All right there was no question:)
It is about NOT correct statement
Compatibility is about execution not compilation.

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Mon May 15, 2017 8:30 pm
by lenalena
I don't understand why Option 1 is correct. How could assertions have been implemented without the change to the JVM? Or does all assertions-related code gets substituted with some "standard" code at compile-time?

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Mon May 15, 2017 10:48 pm
by admin
Yes, an assert statement basically just gets converted to an if statement -
if(!condition) throw new AssertionError(message);
There is no need for any changes to the JVM for this.

Here are the details: http://www.benf.org/other/cfr/how-is-as ... ented.html

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Thu Jun 01, 2017 11:26 pm
by mabilalmirza
Answer is confusing...

Option 1 says change required at JVM level, and comment says no change is required. This is conflicting yet this is shown correct.

Option 3 seems correct as comment says we can do whatever option says by using switches. But this is not shown correct.


Can someone explain the state (in attached image) and correct/incorrect answers?

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Fri Jun 02, 2017 12:23 am
by admin
Read the problem statement carefully. It asks you to select statements that are wrong.

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Fri Jun 02, 2017 5:58 am
by mabilalmirza
Oops...

Thanks for helping. Sorry for inconvenience.

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Fri Jul 27, 2018 5:47 pm
by __JJ__
Erm, how and why are we expected to know that when the assertions mechanism was brought in (in version 1.4? like over a decade ago?) that it didn't require changes at the JVM level, because they are implemented internally with some kind of preprocessor logic?

I mean, seriously, are we expected to know this?

If we are expected to know this why are we not expected to know load of other JVM spec gubbins that have no value whatsoever?

Knowing that the JVM didn't need a specification change when assertions were brought in has ZERO value. ZERO. It makes ZERO difference to how and where we are supposed to use assertions. Please, correct me if I'm wrong (I usually am, I accept that).

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Fri Jul 27, 2018 5:53 pm
by __JJ__
These two sentences:
No change is required in the JVM for supporting assertions.
Assertions require changes at the API level.
should instead say this:
No change was required in the JVM for supporting assertions.
Assertions required changes at the API level.
We are talking about something that happened many years ago, correct? I remember now why I found this question so confusing. I was thinking, WTH are they talking about?

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Fri Jul 27, 2018 9:22 pm
by admin
No, you don't need to know the dates or the version. This is just basic information about assertions.

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Sun Jul 07, 2019 3:07 am
by Perelun
"Code written for JDK version 1.3 cannot be compiled under JDK version 1.4"
what does it have to do with java 8?

Re: About Question enthuware.ocpjp.v8.2.1322 :

Posted: Sun Jul 07, 2019 10:41 am
by admin
You are right. This question has now been removed from the test.
thank you for your feedback!
Paul.