Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assertions and Wrapperclass

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
What is wrong here with assertions enabled at run time?

Boolean b = new Boolean("false");
assert b:"Assertions failed";

I have a question. If I run this code against 1.4, it produces compiler error. Is it because the autobox facility is not available in 1.4 and does this compile succesfully in 1.5? I dont have 1.5 version. So can anyone help me with this?

Regards,
Jothi Shankar Kumar. S
 
Charith Fernando
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this compiles in JAva 5.. simply because of the reason you have speicified... autoboxing
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charith Fernanda,

Thanks for confirming.

Regards,
Jothi Shankar Kumar. S
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic