All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in java

Options
- are private
- are serializable
- are immutatable
- are final


CORRECT ANSWER : are final

Discussion Board
java

ll. all the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in java
Options
- are private
- are serializable
- are immutatable
- are final
all wrapper class are immutable also .........

Basanta kumar hota 09-17-2015 02:22 PM

All of the wrapper classes implement Serializable

The wrapper classes are all final AND implement Serializable. So the correct answer is b & d

Dwight Lillie 04-13-2015 05:09 PM

Wrapper class

Wrapper classes provide the way to wrap the data in a new object which contains the value of the variable. Then the object can be used just with any other object like a normal method. These are final as the value is defined already and the object, method or variable is being called wherever it is required without initializing it again. For example:

PI: Suppose we need the value of it in 10 programs correct to ten decimal places, writing them again and again is a very tiresome process but initializing the variable name pi in the beginning of the program and use variable wherever is required will save time.

double pi = 3.1428571428;
double volume = pi * radius * radius * height;

To remove the cases where the pi value can be overrided by some other value we use final variables. If value of variable initializes once can't be changed later on during the execution of the program. It can be described as:

final double pi = 3.1428571428;

So, the same way int, float, short, long, etc. also have a pre-defined value that can't be changed in any manner.

Rohit Sharma 07-30-2014 03:23 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement