What are wrapper classes?

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


Please Help Members By Posting Answers For Below Questions

Why java is not 100% object-oriented?

1210


EDS (Electronic Data Systems India Pvt Ltd) at Chennai on 16-12-2006.

8926


What is the difference between equals() and == in java?

731


What is garbage collection? Can it be forced to run?

786


Explain about java sdk?

824


What is a map in java?

780


What is the SimpleTimeZone class?

2028


Define locale.

831


What is replacefirst in java?

794


What are the main concepts of oops in java?

1164


What is binary search in java?

804


How can we make a class virtual?

865


What is subsequence of a string?

865


Write a function for palindrome and factorial and explain?

883


What is size_t?

766