Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in K&B SCJP 5: assert and boxing

 
Cindy Rogers
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
p 373 (in section "Assertion Expression Rules"): "The first expression must always result in a boolean value!"

p 375 (in Exam Watch box): "An assert expression must result in a boolean value, true or false?"


I found that boxing applies to asserts; that is, the first expression may be a boolean or a Boolean.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cindy Rogers:
...I found that boxing applies to asserts; that is, the first expression may be a boolean or a Boolean.

That's correct...
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be pedantic, the Boolean wrapper object is unboxed to a boolean primitive value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic