Jairaj Gaur

Greenhorn
+ Follow
since Nov 25, 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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jairaj Gaur

Rob Prime wrote:Turn them on: use the -ea JVM flag.
Turn them off: don't use that flag.

That's the main thing about assertions - they are conditionally enabled. You should never use any logic that relies on the fact that they are turned on or off. That also means that the assertions cannot have any side effects. The following is just wrong:





Thank You ~ Rob Prime
13 years ago

Rob Prime wrote:Note that you should never ever ever use assertions to validate input to non-private methods, as you don't fully control who is calling those methods. If assertions are the only validation then that validation can be turned off by simply turning off assertions. So instead of
you should write
For private methods or code points inside methods where input validation already took place, assertions are just fine.




What you mean by turning ON &turning OFF of assertions & how do we can achieve it..
13 years ago

Campbell Ritchie wrote:The negative value is supposed to give an error; your assertion is failing. Try changing the line to




Thank You ~ Campbell Ritchie

This is what I want to know.
13 years ago

Campbell Ritchie wrote:Try changing m.check(2); to m.check(-99); and see what happens.




I tried both +ive & -ive value. In +ive value case ,output was "Java ==========", But at -ive value it is giving error. Still my question is nt solved.

What the use of :"a is"+a;

when this condition will execute?
assert(a>0):"a is"+a;
13 years ago
Thank You ~ Jesper de Jong

For your Reply!!!
13 years ago



Hello Frds,

In this program I used asset keyword..
I just want to know what is the difference between simple & really simple asset
& wat ll be the output for this program.
& if output is "Java==================" then wat does "assert(a>0):"a is"+a;" this line means & what is the use of it.

Waiting for your reply!!!

From ~ Jai
13 years ago