File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class declaration with parameter type

 
Harshana Dias
Ranch Hand
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is called as Generics
 
Harshana Dias
Ranch Hand
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic