TheObserver
Programmer
Is there any way to call a method in an ancestor class?
For instance:
public class A
{
public A()
{
B myB = new B();
}
public methodA()
{
System.out.println("Hola");
}
}
public class B
{
public B()
{
methodB();
}
public methodB()
{
A.methodA();
}
}
I know about "extends" but I'm not sure it will work as I intend it to. Also, in the case of my actual code, the class (at the same level as class B above) already extends JFrame, and I don't know of a way to do multiple "extends".
Thanks for your time.
For instance:
public class A
{
public A()
{
B myB = new B();
}
public methodA()
{
System.out.println("Hola");
}
}
public class B
{
public B()
{
methodB();
}
public methodB()
{
A.methodA();
}
}
I know about "extends" but I'm not sure it will work as I intend it to. Also, in the case of my actual code, the class (at the same level as class B above) already extends JFrame, and I don't know of a way to do multiple "extends".
Thanks for your time.