• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error in code when using assertion  RSS feed

 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Now when I tried to compile it this error is coming. I don't know what is its meaning.

A.java:11: warning: as of release 1.4, assert is a keyword, and may not be used
as an identifier
assert j == 2;
^
A.java:11: ';' expected
assert j == 2;
^
1 error
1 warning
 
Bastin Gomez.H
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hemant,

While compiling, use "-source 1.4" option.

For Example: If your filename is Abcd.java, compile as
"javac -source 1.4 Abcd.java". You will get the compilation right.


---------------
SCWCD ....ticking.....
SCJP [91%]
---------------
 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bastin,
Thanks I got the result

[ February 23, 2006: Message edited by: Hemant Agarwal ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!