Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assertions

 
Eric Nadar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
This question is from Skillguru.I tried compiling it and got no output, but the answer is apparently a.I don't understand!



options:
a.runtime exception due to failure at Line 2.
b.Compilation error at Line 1,assert can't take an String object
c.Compilation fails at Line 2, the second expression of assert can't be boolean
d.line 1,2 show a compilation error,as an assert statement can't returns something.
e.The program compiles fine but no output.

Also,can someone please tell me if the second expression of assert can be boolean?!
 
Eric Nadar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
umm..sorry!..i tried compiling it again using -ea..(had totally forgotten that earlier!..:P)...and now i'am getting NoClassDefFoundError!..what do i do?
 
Zhenyi Luo
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Nadar wrote:umm..sorry!..i tried compiling it again using -ea..(had totally forgotten that earlier!..:P)...and now i'am getting NoClassDefFoundError!..what do i do?


I have got "Exception in thread "main" java.lang.AssertionError: false", how did you get NoClassDefFoundError?
 
Eric Nadar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Zhenyi Luo!
i compiled it yet again and i got the Assertion Error this time.Don't know what i did wrong before.Thanks..
 
Eric Nadar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And yeah..i checked if the 2nd expression of assert can return boolean,and yes it can.Sorry for all the trouble!..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic