Tuesday, November 29, 2011

What are wrapped classes?

Wrapped classes are classes that allow primitive types to be accessed as objects.:egs:- intergerclass:Wrapper classes are classes that allow primitive data types.Every primitive data types in java has got the corresponding wrapper class it supports autoboxing and unboxing.:Wrapper classes are those classes which allow to use primitive datatype with additional functionalities associated with it.:Wrapper classes are used to convert primitive type values into objective type values and vice versa. If we want to pass primitive value as object into a method, we can use Wrapper classes. There are different Wrapper classes for all primitive types.:Besically wrapper class used for collections.As collection only support objects so we need oject of the primitive data type.This is possible through Wrapper class.:All the primitive data type are called as wrapper class. ex: int,float,double etc.:Wrapper class is a wrapper around a primitive data type. It represents primitive data types in their corresponding class instances e.g. a boolean data type can be represented as a Boolean class instance. All of the primitive wrapper classes in Java are immutable i.e. once assigned a value to a wrapper class instance cannot be changed further.:Wrapper class is a wrapper around a primitive data type. It represents primitive data types in their corresponding class instances e.g. a boolean data type can be represented as a Boolean class instance. All of the primitive wrapper classes in Java are immutable i.e. once assigned a value to a wrapper class instance cannot be changed further.:wrapper classes r use for converting primitive data types into objects.here we r having one question i.e why we r converting. Ans: All the web applications will communicate data in Objects only.: what will you do when you want primitive data type to be used as an object? : what will you do when you want primitive data type to be used as an object? :If you to represent the primitive type as Object then Wrapper classes comes into the picture.:Some one is asking for:Both wrapper classes and data types are the same but wrapper classes are start with capital letter.e.g: Integer, Boolean, Float etc.
Category:Java Interview Questions

No comments:

Post a Comment