L
lonelyplanet999
Hi,
I'm studying the 310-035 exam and encounter below problem when I write
code for assertion then compile the program (I used java 1.4.1).
class Assert0 {
public static void main (String [] args) {
assert false;
}
}
assert0.java:6: warning: as of release 1.4, assert is a keyword, and
may not be used as an identifier
assert false;
^
assert0.java:6: not a statement
assert false;
^
assert0.java:6: ';' expected
assert false;
^
2 errors
1 warning
As my training book "Sun Certified Programmer & Developer for Java 2
by Kathy Sierra & Bert Bates" teached me similar assertion syntax but
it's full of typing mistakes, I browsed sun's homepage to double
verified if I made any syntax error during coding.
I found the page http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
also has similar assert false; assert <expression>; statements.
Could any commented what's wrong with my code ?
Tks!
I'm studying the 310-035 exam and encounter below problem when I write
code for assertion then compile the program (I used java 1.4.1).
class Assert0 {
public static void main (String [] args) {
assert false;
}
}
assert0.java:6: warning: as of release 1.4, assert is a keyword, and
may not be used as an identifier
assert false;
^
assert0.java:6: not a statement
assert false;
^
assert0.java:6: ';' expected
assert false;
^
2 errors
1 warning
As my training book "Sun Certified Programmer & Developer for Java 2
by Kathy Sierra & Bert Bates" teached me similar assertion syntax but
it's full of typing mistakes, I browsed sun's homepage to double
verified if I made any syntax error during coding.
I found the page http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
also has similar assert false; assert <expression>; statements.
Could any commented what's wrong with my code ?
Tks!