Answer Posted / 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 View All Answers
Which is better stringbuilder or stringbuffer?
why Java does not support multiple inheritances?
What is unicode datatype?
4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (
Does every java program need a main?
What is linked hashmap and its features?
What an i/o filter?
What is difference between equals and hashcode method?
What is the benefit of abstract class?
What is the maximum size of arraylist in java?
What is meant by overloading?
Can we restart a dead thread in java?
What does string intern() method do?
What is a boolean flag in java?
Can you extend singleton class?