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

  • Home
  • SEARCH
  • 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 8589523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:04:38+00:00 2026-06-11T23:04:38+00:00

My Class Architecture goes like this. I have an interface myInterface. I create a

  • 0

My Class Architecture goes like this.

I have an interface “myInterface”. I create a class “mySuperMostClass” which implements “myInterface”. Now i create a class “myBaseClass” which extends “mySuperMostClass”. Then i create “mySubClass” which extends “myBaseClass”. I have overridden the methods “methodA”, “methodB” from “myBaseClass” in “mySubClass”.

“methodB” is called from “methodA”

Now i create an object for mySubClass and refer it with instance of “myInterface”. When i call methodA with the instance of myInterface, the implementation from “myBaseClass” is called. But i want it to call “mySubClass”. Kindly help me to do this.

I am using Java 1.5

  • 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-11T23:04:39+00:00Added an answer on June 11, 2026 at 11:04 pm

    First of all, I’m sure that your actual class names don’t start with lowercase. If they do, I would suggest that you read about Java Naming Convention

    When overriding methods from your parent class make sure that the method signature remains consistent. For example, if you have a method called public void method(String input), you’ve to make sure that the same signature is maintained in the child class.

    So, from reading your question, I assume the correct implementation would be something like this:

    public interface MyInterface{
    }
    
    class  MySuperMostClass implements MyInterface{
    
    }
    
    class  MyBaseClass extends MySuperMostClass{
        public void methodA(){
        }
    
        public void methodB(){
        }
    }
    
    class MySubClass extends MyBaseClass{
    
        @override
        public void methodA(){
            methodB();
        }
    
        @override
        public void methodB(){
        }
    }
    

    Note: I’m not so sure of the actual signature of your methods, hence I’ve kept them as parameterless. In your case, make sure that the signature remains the same.

    And the way you would call would be something like this:

    MyInterface myObject = new MySubClass();
    myObject.methodA();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class defined like this : @interface ServerCall : NSObject { //
I have an assignment for my architecture class which to implement a 31 backgammon
The current structure of my classes goes a little bit like this: PC.Processor.Architecture[0] =
I'm stuck on creating a class architecture to do this: I have very many
class A attr_accessor :dab .... end Now I have an array of instances of
I've got an architecture like the following: Data (Class Library that handles our Entity
I have a SalesOrder class which is inherited by several different types of sales
Our architecture uses the Repository pattern extensively. We have an abstract base class for
I know that it is poor programming and architecture when you have a class
I have a architecture question about legacy. For example I have a class that

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.