Answer Posted / guest
The wrapper classes can take constructors of either the
type they are designed to wrap or of a String that can be
converted to that type. Thus the Integer class can take a
number that could be contained by an int, but an error will
occur if you try to pass a number with a floating point
component. Remember that the wrapper classes are just that
classes, they are not primitives and instances of the
wrappers can only be manipulated in the same way as any
class. You may get questions on the exam with code that
uses standard math operations to manipulate instances of
wrappers. You can of course use the + operator where it
would implicitly call the toString method, but as soon as
you see the - * or % operator, beware.
| Is This Answer Correct ? | 7 Yes | 8 No |
Post New Answer View All Answers
Why do we need wrapper class?
What are user defined exceptions?
What is a method header?
Why char array is favored over string for the storage of passwords?
What is the default size of arraylist in java?
Why is java so popular?
What is the default size of set in java?
What is meant by local variable and instance variable?
Which browsers work with java?
Can I declare a class as private?
What is abstract class constructor called?
What is the difference between class & structure?
Is java a compiler?
Can we have any other return type than void for main method?
What is difference in between java class and bean?