aspose file tools
The moose likes Java in General and the fly likes How List.add(Primitive Value) works in real Life Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How List.add(Primitive Value) works in real Life" Watch "How List.add(Primitive Value) works in real Life" New topic
Author

How List.add(Primitive Value) works in real Life

himkar dwivedi
Greenhorn

Joined: Mar 02, 2010
Posts: 5
Hi I am new for java and wat to know that

int intValue=10;
List aList=new ArrayList();
aList.add(intValue);

This statment is fine for java 5 and giving error for java 4. I need to know how add method convert this primitive to Integer Object

Thanks
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 361

This will help you Iintroduction-to-autoboxing


Pawan Chopra
SCJP - DuMmIeS mInD
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32599
    
    4
Useful link, pawan chopra.


himkar dwivedi, welcome to the Ranch Why are you not parameterising your List?
himkar dwivedi
Greenhorn

Joined: Mar 02, 2010
Posts: 5
Thanks, This is very helpful link
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How List.add(Primitive Value) works in real Life
 
Similar Threads
operator precedence
How to determine a method using or not using static modifier ?
Equals operator
Help with Arrays and ArrayLists
Sorting vectors... a nightmare?