I have defined an interface like this:
public interface InterfaceA {
String getMyString();
}
And I have two classes that implement the interface:
public class MyClassA implements InterfaceA {
@Override
public String getMyString(){
return "A";
}
}
public class MyClassB implements InterfaceA {
@Override
public String getMyString(){
return "B";
}
}
What I am trying to do is to create a method that accepts an object that implements InterfaceA as an argument and call its getMyString method. Here is some pseudo code that illustrates what I'm trying to accomplish:
public String getStringTest(T implements InterfaceA){
return T.getMyString;
}