A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Confused about "assert"
Joined: Jan 24, 2007
Oct 18, 2007 04:24:00
I can't understand if assert is always a keyword and it can't be used as identifier,
assert is a keyword, only if compiling with assertion enabled.
Objective: SCJP 1.5<br /><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html" target="_blank" rel="nofollow">API</a><br /> <blockquote><font size="1" face="Verdana, Arial">code:</font><hr><pre><font size="2"><br />Double n1 = Double.NaN; Double n2 = Double.NaN;<br /> n1.equals(n2) // true even though Double.NaN != Double.NaN<br />-0.0 == +0.0; // true<br />Double n1 = -0.0;Double n2 = +0.0;<br />n1.equals(n2) // false even though -0.0 == +0.0<br /></font></pre><hr></blockquote>
Joined: Sep 17, 2007
Oct 18, 2007 04:55:00
I guess assertion enabling and assertion disable (-ea and -da) is only when executing. ie with
command and not javac compiler options.
checking whether assert has been used as a keyword or as a identifier comes into picture when you compile with javac, and when you use the -source options.
SCJP 5.0<br />SCJD working on it
I agree. Here's the link:
subject: Confused about "assert"
Keyword and reserved words in 1.4
Is assert a java keyword?
r they keywords or literals?
i would like to know the
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014