| Author |
Method Syntax
|
Steven Zaluk
Greenhorn
Joined: Sep 19, 2003
Posts: 3
|
|
I have seen code like below a couple of times now but I am not sure exactly what the <X> X part means. Can anybody explain this to me?
Thanks,
Steve
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
|
If you only had "public X get(String key);" the compiler would think that X is a real class. However, in your case, X is not a real class, but a generic class. You use <X> to tell the compiler that X is a generic class.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
Generic methods and constructors
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Method Syntax
|
|
|