Create Different update() Methods for Observer
Hello, world!
I have an Observer/Observable set up, and I would like to accept two different object types from the observable. I tried just making the two update functions:
Code:
public void update(Observable observable, Integer message) {
// do something with message
}
public void update(Observable observable, String message) {
// do something with message
}
public void update(Observable observable, Object message) {}
But they weren't called, instead the main update(Object) method was called. How can I get it to call my other update()s instead, or is there another way to accept multiple types (without typecasting; I need to know what type of object it is).
Thanks!