aspose file tools*
The moose likes Beginning Java and the fly likes Method Syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Method Syntax" Watch "Method Syntax" New topic
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: 14688
    
  16

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: 19783
    
  20

Generic methods and constructors


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Method Syntax