• Post Reply Bookmark Topic Watch Topic
  • New Topic

booleanValue()--help needed-exam in 2 days  RSS feed

 
Jui Mahajan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the Kathy Sierra book does not mention any method called booleanValue(), but when I ran the following code, it compiled well and on running , printed true.
public class juhi{
public static void main(String[]args){
Boolean b=new Boolean(true);
boolean b1=b.booleanValue();
System.out.println(b1);
}
}
SO in the exam, will we get a question on booleanValue(), and if we do, what shud we do ? According to the KB book, there r no such methods as charValue() and booleanValue(), so occurence of these methods in the code results in a compiler error.
 
Vad Fogel
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exam objectives state the following:
Describe the significance of wrapper classes, including making appropriate selections in the wrapper classes to suit specified behavior requirements, stating the result of executing a fragment of code that includes an instance of one of the wrapper classes, and writing code using the following methods of the wrapper classes (e.g., Integer, Double, etc.):
o doubleValue
o floatValue
o intValue
o longValue
o parseXxx
o getXxx
o toString
o toHexString

Even though Boolean and Character wrapper classes are not mentioned explicitly, I would go ahead and refresh basic methods of Boolean and Character like their constructors, toString(), and xxxValue(). Good luck on the exam!!!
 
Bert Bates
author
Sheriff
Posts: 8946
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jui -
I just took a look at pages 378-379. I suppose you can infer that the methods:
charValue() and booleanValue()
don't exist. What we're really getting at is that they won't be on the test. Sorry for the confusion. There are quite a few methods in the wrapper classes that are not covered on the exam, and we're focusing on only those methods that ARE on the exam.
There IS however an error in the Sun objectives. the getXxx methods are NOT covered on the exam, but the valueOf methods are covered, a LOT!
-Bert
 
Jui Mahajan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bert, so if we do get a method called booleanValue() or charValue() on the test, should we consider this as a compiler error and mark the answer likewise?
Thanks
jui
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!