Results 1 to 2 of 2
Thread: Integer vs int
- 11-14-2007, 07:36 PM #1Senior Member
- Join Date
- Nov 2007
- Rep Power
- 11-14-2007, 09:13 PM #2
In j2se 1.5 autoboxing was introduced which automatically converts the int value "2" to an Integer object in this statement.
Integer first_i = 2;
Integer is a wrapper class that wraps the primitive int value and makes it an Object for use where objects are required such as for use in the interface Comparable or for Collection interface implementations, eg, ArrayList.
For more see The Numbers Classes.
- By Emily in forum New To JavaReplies: 1Last Post: 03-06-2008, 06:39 PM
- By bluegreen7hi in forum New To JavaReplies: 11Last Post: 01-24-2008, 08:54 AM
- By hey in forum New To JavaReplies: 4Last Post: 12-14-2007, 09:48 PM
- By mew in forum New To JavaReplies: 3Last Post: 12-06-2007, 09:28 PM
- By susan in forum New To JavaReplies: 1Last Post: 07-14-2007, 05:25 AM