What is the point of T extends SomeClass?

Viewed 1124

What is the difference with a method declaration like this:

public <T extends SomeClass> void doSomething(T obj)
{
    // Do something.
}

And this:

public void doSomething(SomeClass obj)
{
    // Do Something.
}

The way I see it, both of them are specifying that the object passed in must be a subclass of type SomeClass, so why bother with the generics at all in this instance?

1 Answers
Related