Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can anyone explain me the concept of autoboxing?

Answers were Sorted based on User's Feedback



can anyone explain me the concept of autoboxing?..

Answer / durga ganesh reddy

autoboxing is that the conversion of primitive data types
into wrapper class objects automatically.By using generic
types of java 1.5,we an acheive it easily.By declaring, the
collection classes as shown below we can do it.
HashSet<Integer> hs=new HashSet<Integer>();
hs.add(1);
hs.add(2);
Iterator it=hs.iterator(0;
while(it.hasNext())
System.out.println(it.next());

Is This Answer Correct ?    11 Yes 0 No

can anyone explain me the concept of autoboxing?..

Answer / jitu

In case of autoboxing directly the value of the constructor
assign to a variable.i.e object of wrapper class directly
assign to a variable.but it is only possible in case of 1.5
version.
Ex:public class X
{public static void main(String a[])
{Integer i1=new Integer("20");
Integer i2=new Integer("20");
int m1=i1;
int m2=i2;
S.o.p(m1+m2);o/p-20

Is This Answer Correct ?    3 Yes 0 No

can anyone explain me the concept of autoboxing?..

Answer / srinu

auto boxing:-
The process of conversion of primitive data type into wraper
class object into AUTOMATICALLY is called Auto boxing.
By using generic types of java 1.5,we an acheive it
easily.By declaring, the collection classes as shown below
we can do it.
EX:

HashSet<Integer> hs=new HashSet<Integer>();
hs.add(1);
hs.add(2);
Iterator it=hs.iterator();
while(it.hasNext())
{

System.out.println(it.next());
}
(Note: original it.next() returns object but here
System.out.println print primitive datatypes.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Core Java Interview Questions

what is mean by String and StringBuffer? What is mean by Methooverriding and Overloading?

3 Answers   Satyam, STI,


does core java and j2se both are same?

5 Answers  


How many types of thread in java? give the name

13 Answers   Cisco, NIIT,


How can we find the sum of two linked lists using stack in java?

0 Answers  


Why java is a platform independent? Explain

0 Answers  


Can a class extend more than one class?

0 Answers  


What is void data type?

0 Answers  


How many bits is a word?

0 Answers  


Difference between String and String Buffer?

3 Answers  


What are the two parts of a conditional statement?

0 Answers  


Explain the importance of throws keyword in java?

0 Answers  


What is byte data type?

0 Answers  


Categories