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 Doubt on assertions question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt on assertions question" Watch "Doubt on assertions question" New topic

Doubt on assertions question

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486

Can someone tell why its throwing error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on tokens, delete these tokens
Syntax error, insert ": Expression" to complete Expression
Syntax error, insert ";" to complete AssertStatement

at oddemo.main(

Please help me out.
source is :whizlab

[BSouther: Added UBB CODE tags]
[ March 04, 2008: Message edited by: Ben Souther ]

Thanks<br />Dinesh
Ajay Singh
Ranch Hand

Joined: Jan 04, 2008
Posts: 105
in the second expression of the assert statement anything which returns a value is to be passed

for ex:


here true and false are boolean values,you cant pass a string from can even pass a int,char,boolean,object etc.

somebody correct me if i am wrong.
Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
Thanks for your reply.
I agree. Here's the link:
subject: Doubt on assertions question
It's not a secret anymore!