• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on assertions question

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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 ]
 
Ajay Singh
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic