File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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
" 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?
[ March 18, 2003: Message edited by: Veena Point ]

"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"
and started with:
java -ea asert
java -da asert
-da = disable assertions
-ea = enable assertions
I agree. Here's the link:
subject: Simple question on assertion
It's not a secret anymore!