Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What does it mean

 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This example is from Niko's blog



What does <T> means here?

say is not returning anything as its void method.

Can anybody please explain?
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here <T> is the type declaration for the method which is unused as the method neither accepts parameters of type <T> nor does it return a value of type <T>...
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then what is the use of this?
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
read it from here.
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Harpreet Singh janda wrote:Then what is the use of this?

In this particular example, there is no use of the generic type. It is just done that way to make the question a little confusing...
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:
Harpreet Singh janda wrote:Then what is the use of this?

In this particular example, there is no use of the generic type. It is just done that way to make the question a little confusing...

I did not post that link for an example. i gave that link to know more about generics.

We may say
you must declare the type variable BEFORE the return type of the method
but it will become much confusing again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic