ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
can anyone explain  me the concept of autoboxing?
 Question Submitted By :: Shreya
I also faced this Question!!     Rank Answer Posted By  
 
  Re: can anyone explain me the concept of autoboxing?
Answer
# 1
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 ?    5 Yes 0 No
Durga Ganesh Reddy
 
  Re: can anyone explain me the concept of autoboxing?
Answer
# 2
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 ?    1 Yes 0 No
Jitu
 
 
 
  Re: can anyone explain me the concept of autoboxing?
Answer
# 3
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 ?    0 Yes 0 No
Srinu
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Why do we use public static with the main function in Java? Infosys7
What is Vector?Can you elaborate how Vector is Thread safe?  3
Howmany number of objects we can store in an ArrayList. Is there any limit? TCS5
How multipleInheritance is possible in java? Satyam16
what is sendredirect? TCS3
what is the difference between AWT and SWING what is the advantage of using swing?  3
what is difference betwwen hashmap and hashtable ? Fidelity6
Which are thin and thicK wrapper Class's in Java?  1
What is encapsulation? Elaborate with example? BMC1
What is left shift and right shift?  1
Adapter classes?  3
84. try { 85. ResourceConnection con = resourceFactory.getConnection(); 86. Results r = con.query(”GET INFO FROM CUSTOMER”); 87. info = r.getData(); 88. con.close(); 89. } catch (ResourceException re) { 90. errorLog.write(re.getMessage()); 91. } 92. return info; Which is true if a ResourceException is thrown on line 86? 1 Line 92 will not execute. 2 The connection will not be retrieved in line 85. 3 The resource connection will not be closed on line 88. 4 The enclosing method will throw an exception to its caller.  1
For which statements we use a label? Wipro3
What are the OOPS concepts in Java ? Satyam3
How many ways can an argument be passed to a subroutine?  2
What happens if an exception is not caught?  4
how many access specifiers are available in java  5
Can a lock be acquired on a class?  2
What is a native method?  2
In what type of containers, Border layout is a default layout?  3
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com