aspose file tools*
The moose likes Beginning Java and the fly likes ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ArrayList" Watch "ArrayList" New topic
Author

ArrayList

renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi,
is there something like this


Cheers,
Richard
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Yes, the declaration of an ArrayList looks something like that.

Justin


You down with OOP? Yeah you know me!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi Renu,

I think what you're asking is whether you can use a primitive like "int" as a generic type parameter to a class. The answer is no, you can't; Java doesn't support that.


[Jess in Action][AskingGoodQuestions]
Balagopal Kannampallil
Ranch Hand

Joined: Oct 18, 2004
Posts: 136

Hi,

One can only use reference types as the Type argument while using generics. You can make your own generic classes but cannot use primitives as Type arguments. You can use their wrappers as Type arguments and put the primitives directly into the ArrayList with the help of autoboxing.


SCJP 5.0 and now fighting with ExtJS
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ArrayList