EDIT: Solved, see below
Hi,
In Java, I got an object that could be of any class. BUT - that object will always have to implement an interface, so when I call methods defined by the interface, that object will contain that method.
Now, when you try to call a custom method on a generic object in Java, it mucks about typing. How can I somehow tell the compiler that my object does implement that interface, so calling the method is OK.
Basically, what I'm looking for is something like this:
Object(MyInterface) obj; // Now the compiler knows that obj implements the interface "MyInterface"
obj.resolve(); // resolve() is defined in the interface "MyInterface"
How can I do that in Java?
ANSWER: OK, if the interface is named MyInterface you can just put
MyInterface obj;
obj.resolve();
Sorry for not thinking before posting ....