0

I'm still thinking about such case - two method declarations:

public <T extends MyClass> void method1(T val)

public void method2(MyClass val)

what is the principal difference between these two declarations? In either case I can use object of MyClass and it's child classes.

So what is the benefit of using generics here?

I will be thankful if someone explains this to me. Thank you!

  • https://stackoverflow.com/a/21390747/1787314 This should help you clear the doubt! – Nick Div Aug 08 '17 at 15:47
  • I posted an answer, but then [moved it](https://stackoverflow.com/a/45573779/2643425) to the duplicate question, since the existing answer there is talking about a different situation and doesn't actually answer the question. – Sean Van Gorder Aug 08 '17 at 16:44
  • In this case, there is no difference between the two and there is no benefit to the generic version. – newacct Aug 16 '17 at 06:16

0 Answers0