wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Simple question on assertion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Simple question on assertion" Watch "Simple question on assertion" New topic
Author

Simple question on assertion

Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
I have JSDK1.3 version.But compier is giving following error for my assertion program asert.java...
"asert.java:10: cannot resolve symbol
symbol : class assert
location: class asert
assert a ;"
Here I am pasting the code...

I kept code simple coz , I just wanted to play with assert keyword.
Can anybody please lemme know why is it not taking assert keyword?
Thanks
Veena
Thanks
Veena
[ March 18, 2003: Message edited by: Veena Point ]

SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Sarma Lolla
Ranch Hand

Joined: Oct 21, 2002
Posts: 203
What happends if you compile it using -source 1.4 switch?
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
In 1.3 assert is not a keyword. In your program, assert is a user-defined identifier.
The compiler thinks assert is the name of a class (or interface). You are declaring a variable a of class type assert. However the variable a has already been declared as type boolean.
Jonas Isberg
Ranch Hand

Joined: Mar 18, 2003
Posts: 118
If you download java version 1.4, your code should run fine when compiled with:
javac -source "1.4" asert.java
and started with:
java -ea asert
or
java -da asert
-da = disable assertions
-ea = enable assertions
 
Consider Paul's rocket mass heater.
 
subject: Simple question on assertion