Giorgio Francescangeli

Greenhorn
+ Follow
since May 10, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Giorgio Francescangeli

Hello Tayitu Betule,

I am studying for the SCJP exam, and I am not an expert.

To reply to your post I think the code prints out "done" because the assertions are ignored,
there is nothing that tell us that the assertions are enabled, thus at run time these lines of code are not executed.

To enable assertions it needs to be specified with a flag in the command line:
java -enableassertions AssertTest
or with the short flag, which is equivalent
java -ea AssertTest

Regards,

Giorgio