Virtual Position Forum
Please register to watch content in detail
Thanks
Admin virtual position


Join the forum, it's quick and easy

Virtual Position Forum
Please register to watch content in detail
Thanks
Admin virtual position
Virtual Position Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

what is boxing or unboxing and what is the uses of it in java language, ?

View previous topic View next topic Go down

GMT + 3 Hours what is boxing or unboxing and what is the uses of it in java language, ?

Post by WikiLeaks Sun May 29, 2011 2:35 pm

Boxing & unboxing is the process of converting a primitive value into an object oriented wrapper class (boxing), or converting a value from an object oriented wrapper class back to the primitive value (unboxing).

Java 5 supports automatic conversion of primitive types (int, float, double etc.) to their object equivalents (Integer, Float, Double,…) in assignments, method and constructor invocations. This conversion is know as autoboxing.

Java 5 also supports automatic unboxing, where wrapper types are automatically converted into their primitive equivalents if needed for assignments or method or constructor invocations.For example:

int inative =0;

inative = new Integer(5); // auto-unboxing

Integer intObject =5 ; // autoboxing
WikiLeaks
WikiLeaks
Monstars
Monstars

Posts : 26
Join date : 2011-05-29

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum