The: cboStart.addItem(new Integer(1)) will add Integer objects to the ComboBox and you will have to cast them to Integer when you get the values.
I Think the second is wrong since if I remember correctly the addItem() method takes Objects as arguments.
With Java 1.5 or later,
Integer.valueOf(1) would be preferable to constructing a new Integer.
The second method,
cboStart.addItem(1) also works just fine because auto-boxing will make the conversion to an Integer object for you.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Offline 6,756 posts
since May 2007