What's the difference between <T> T vs T in the return type of a method?

Viewed 1190

I have a method, like this,

public <T> T doSomething(Class<T> T) {
return T.newInstance();
}

I can also do the same like this,

public T doSomething(Class<T> T) {
return T.newInstance();
}

Is there any difference between these two? Please ignore T.newInstance(), I'm basically going to create a new instance of T somehow and return it.

thanks, sam

3 Answers
Related