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 main method is called first in java?

546


Does treeset allow null in java?

515


What is parseint?

540


Can You Have Virtual Functions In Java?

588


How to display all the prime numbers between 1 and 100

507






What are different exception types exceptions available in java ?

483


How does compareto method work?

524


How many bytes is double?

549


Differences between traditional programming language and object oriented programming language?

574


What does java se mean?

591


What is the difference between private & public & friendly classes?

553


What is the benefit of lambda expressions?

497


What is exception handling in java?

576


Do extraneous variables affect validity?

528


Can we use different return types for methods when overridden?

556