Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8778891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:38:26+00:00 2026-06-13T19:38:26+00:00

For my Java class, we are learning about interfaces, polymorphism, inheritance, etc. The homework

  • 0

For my Java class, we are learning about interfaces, polymorphism, inheritance, etc.

The homework assignment I am working on is a memory game where you have pairs of cards all face down and you turn over two at a time looking for a match. If they match, they stay visible, if they don’t, the cards are turned back over and you pick two more cards.

My design so far is as follows:

public interface Hideable
  public abstract void hide();
  public abstract void show();    

public interface Speakable
  public abstract String speak();

public interface AnimalCard extends Hideable, Speakable
  public abstract boolean equals(Object obj);

public class Animal implements AnimalCard
  public void hide() { ... }
  public void show() { ... }
  public boolean equals(Object obj) { ... }

  // What do I do for the speak method since a generic Animal
  // can't speak, but I have to provide a definition since the
  // Animal class is implementing the interfaces.

public class Puppy extends Animal
  // Here is where I need to define the speak method.
  public String speak() { ... }

My question is in the comments above. I feel like I’m implementing this incorrectly with regard to the speak() method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:38:27+00:00Added an answer on June 13, 2026 at 7:38 pm

    Just make the Animal class abstract.
    Concrete classes will have to implement speak(), or be abstract themselves.

    public class abstract Animal implements AnimalCard {
        public void hide() { ... }
        public void show() { ... }
        public boolean equals(Object obj) { ... }
    

    There’s no need or value in declaring an abstract method for speak() in Animal – that method is implied by the class hierarchy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently learning about class inheritance in my Java course and I don't understand
in my java class we were learning about arrays and this question came up.
I am learning about the Runtime class in java, and am testing the use
I'm new to learning JSPs and Servlets. I have a Java class which calls
Suppose you have a Java class hierarchy of about 30 classes, with a base
I'm learning about text processing in Java for a class and the example in
I'm an iPhone/Objective-C newbie with an extensive Java background. I'm learning more about memory
I'm starting with Java and I'm learning about setters, getters and encapsulation. I have
hi i am learning about Java interfaces. I read in Java tutorial that an
I'm 14 and have been learning java for about 4/5 months. I'm coding a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.