About question com.enthuware.ets.scjp.v6.2.27 (hoping reference is right)

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ALain38

About question com.enthuware.ets.scjp.v6.2.27 (hoping reference is right)

Post by ALain38 »

The question is:
You have just written a Java class named AssertTest.java that uses the assertion facility. Write down the syntax for compiling this program using Javac.
[Do not write the classpath or any other switches, just use the one/ones that is/are absolutely needed. Start with: javac ...]
But, in the possible (right) answers, the switch -ea is never used (and it is why my own answer is declared wrong). As assertions are disabled by default how the code can "uses the assertion facility" if the switch is not present?

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About question com.enthuware.ets.scjp.v6.2.27 (hoping reference is right)

Post by admin »

The question only asks about how to compile it without using any switches that not necessary. -ea is required to enable assertions at runtime. It has nothing to do with compilation. In other words, -ea doesn't apply to javac. It applies to java.

HTH,
Paul.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests