Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Calling grandfather class methods

Posted on 2004-10-23
Medium Priority
Last Modified: 2010-05-18
Hi everyone,

I need to call a method for a class up in the hierarchy.  That has similar meaning to super.super.method1();

parent of the parent's method1

Question by:The14follower
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 24

Accepted Solution

sciuriware earned 500 total points
ID: 12391793
You can't.
There's 3 ways of doing this:
1) just call the inherited method,
2) have the super class call   super.method() for you,
3) make it static so it is accessible by class name.
LVL 14

Expert Comment

by:Tommy Braas
ID: 12391921
Hi The14follower,

Unless you're able to do the first of sciuriware's suggestion, I would contend that there is a problem in your class design. You might be better off fixing the class hierarchy, rather than trying to hack your specific need.

LVL 24

Expert Comment

ID: 12391997
May be this question is raised because it's possible in C++ which is, for that matter, a very confusing feature:

     class C : B ....

     class B : A ....

in C:
          A::function() .....


Author Comment

ID: 12407479
Thank you very much.  That will save my time trying to do nothing.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question