how to compile java with assert statement
I failed to compile this simple example
public class Foo
{
public void m1( int value )
{
assert 0 <= value;
System.out.println( "OK" );
}
public static void main( String[] args )
{
Foo foo = new Foo();
System.out.print( "foo.m1( 1 ): " );
foo.m1( 1 );
System.out.print( "foo.m1( -1 ): " );
foo.m1( -1 );
}
}
# javac Foo.java
Foo.java:5: warning: as of release 1.4, assert is a keyword, and may not be
used as an identifier
assert 0 <= value;
^
Foo.java:5: not a statement
assert 0 <= value;
^
Foo.java:5: ';' expected
assert 0 <= value;
would you please tell me why? thank you
~ ªÑ²¼»ù®æ¦³¤É¦³¶^, ¶R½æ*n¯à©Ó¾á*·ÀI ~
~ Samba, more than a low cost File and Printer server ~
-- Let us OpenSource --