Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

basic confusion for dealing with assertions!!

 
anjali desh
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have got this very basic doubt for questions involving assertions.Will the question explicitely tell that the assertions are enabled or not??? And if it is not mentioned ,should we assume the default behavior that assertions are disabled and select the corresponding output?



Should we select the outptut "finished" assuming that assertions are disabled?
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question will say if assertions are enabled or disabled. If at all, it doesn't I would assume assertions are enabled and answer it because the question is about assertions.

But, this confusion would not be effected. The question will be very clear.
 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anjali,
Yes, as far as I think you should stuck on to the default behaviour of the assertions until and unless it is explicitly stated that code is compiled and run with assertions enabled. Otherwise you should just ignore assertions.
But mind you if you are going for SCJP 5.0, so keep in mind that in JDK 1.5 assertions are automatically enabled while compiling, ie. you dont have to use the flag -source 1.4 or -source 1.5.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic