BOXING and UNBOXING (Java)
---------------------------------------------------------------------------------------------------------------------
Well it's not what you see on the YouTube rather than its a Topic when you read about the Wrapper Classes.
Now What are Wrapper Classes?
So the Answer is simple, you have heard about the Primitive data types. So during development it was difficult to use the Primitive data types because if they had used Primitive data types then there was a possibility that their files would have altered the data. This created a need for Objects to use instead of the directly using them.
Now, the Objects accept the properties of the primitive data types. this is why we need Wrapper classes.
Wrapper classes are the Subclass of the Number class.
Diagram of Number Class and its subclasses
_______________________________________________________________________________
And now comes the Boxing and Unboxing.
So, Converting primitive data types into object is called boxing and the vice versa is called Unboxing. They are done by Compiler so the User doesn't have to do much.
No comments:
Post a Comment