Yes.  It declares that the List is going to hold integers.  See
http://www.onjava.com/lpt/a/6014. 

-----Original Message-----
From: Leon Rosenberg [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 21, 2007 1:10 PM
To: Tomcat Users List
Subject: Re: hi,wired problem? add 0 into alist but get 1 as a result!

On 5/21/07, Felix Schumacher <[EMAIL PROTECTED]> wrote:
> Have you tried to put an Object into ArrayList?
> Like
> alist.add(Integer.valueOf(0));
> System.out.println((Integer)alist.get(0));
>
> I don't think it is possible to store an int into an ArrayList.

Autoboxing is the magic word here. The compiler generates alist.add(new
Integer(0)); if it sees alias.add(0); regards Leon

>
> Bye
>  Felix
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to