| 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: 24081
|
|
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: 111
|
|
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.
|
Bala
SCJP 5.0
Gonna hunt down SCWCD soon..
|
 |
 |
|
|
subject: ArrayList
|
|
|