aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt on assertions question" Watch "Doubt on assertions question" New topic
Author

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(oddemo.java:22)

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:

assert(x>10)?true:false

here true and false are boolean values,you cant pass a string from that.you 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.
 
 
subject: Doubt on assertions question