I have two classes
A Dog class whose constructor does not accept arguments,
public class Dog<pet> extends Animal<pet>{} whose constructor does not accept any arguments
and
public class Animal<pet>{} whose constructor accepts one argument

public class Dog<pet> extends Animal<pet>{
    public Dog(){
    super(/*what should go here?*/);
        //Constructor accepts no arguments
    }
}


public class Animal<pet>{
    public Animal(E name){
        //Constructor accepts one argument
    }
}

I need to pass an E type argument to super() inside the constructor of the Dog<pet> class.
How can I do this without passing any arguments to the dog constructor?
Thanks

Turns out I didn't have to extend the Animal class. All that was needed was to implement the AnimalInterface<E>.

Edited 2 Years Ago by Pyler

since we didn't even know of that interface's existance, it would have been hard to spot. but why don't you have to extend the class anymore?
somehow, I assumed the above snippet was not the actual code, just some 'concept'. I assumed there would be at least something of code/variables in the Animal class, making it important to extend it.

This question has already been answered. Start a new discussion instead.