java - Method has the same erasure as another method in type - part 2 -


I get this question completely and its answer. Can anybody help me understand anything given below?

To try hard to digest, why does the compiler error return to the second code snippet given below?

Code 1: Ok compiled

  parents of class {public collection set (collection  c) {}} class child guardian {public Code set: Compiler error on the  set  method in the child class; code set (collection & lt; integer & gt; c) {}}  

  Parents of the class {public zero set (collection & lt ;? & gt; c) {}} extends child child parent {public zero set (collection & lt ; Integer> c} {}}  

is a compiler error

Name Conflict: Method set type (archive) erase in the same way Set), but it does not override

-They override the method, you can see Ject ends with a set method:

  public zero set (collection  c) {}  

which Clearly okay.

In your second example you are not overriding the method on super-type (since the over-riding method is not sub-signature of the method that is trying to override), hence the type of child But it should be possible for the existence of both methods. From the parents

  // Public order set (collection    // From the original: Public Zero Set (Collection c) // From the child: Public Zero Set (archive c)  

Comments