I am learning Java and I want to make my class into an observable class.
However I already have it extending another class.
What should I do?
Java doesn't allow multiple inheritance, so there is no direct way to do it. You should consider using a delegate pattern having your main object that delegates his observer behaviour to an another object..
class YourObject extends ItsAncestorClass
{
private Observer includedObserver;
public Observer getHisObserver(..)
}
Another approach would be turning the object from which your class is extending to an interface, then you'll be allowed to extend from Observer.