#37 Spider Method Inheritance

Companies:
Unknown company
Themes:
JavaJava BasicsCode Review

What will be printed to the screen?

class Arthropod {
    public Arthropod() {
        System.out.println("Super");
    }

    public void prinName(double input) {
        System.out.println("Arthropod");
    }
}

public class Spider extends Arthropod {
    public void prinName(int input) {
        System.out.println("Spider");
    }

    public static void main(String[] args) {
        Spider spider = new Spider();
        spider.prinName(4);
        spider.prinName(9.0);
    }
}

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in