looking for some solutions? You are welcome.

SOLVED: Casting an unimplemented interface to an object

user3193063:

I have a class with the same methods implemented as the interface

public class MyClass {

String getString(final String stringName) {
//doSomething
    };
}

This is the interface definition -

public interface MyInterface {

String getString(final String stringName);
}

Is it possible to cast the interface to the class object-

MyInterface interace = new MyInterface;
MyClass class = (Myclass) interface;



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent