aspose file tools*
The moose likes Java in General and the fly likes class declaration with parameter type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "class declaration with parameter type" Watch "class declaration with parameter type" New topic
Author

class declaration with parameter type

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Why are we declare class like and the advantage or usage of it?

public class Sample<E> {
}

Whats does E refer to?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

It is called as Generics
Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Seetharaman Venkatasamy wrote:It is called as Generics


yer but why should we need to declare it in class level. And what is E means. If its for a object declare a generic type make scenes like below, but for a class?

Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Harshana Dias wrote:
yer but why should we need to declare it in class level. And what is E means. If its for a object declare a generic type make scenes like below, but for a class?


If you click the link that was provided in the first reply, or google for java generics tutorial, those questions will be answered.
 
Don't get me started about those stupid light bulbs.
 
subject: class declaration with parameter type