I am in situation like I have a class which have two different subclasses.
public class SuperClass{
String st;
public String getSt(){
return st;
}
}
class A extends SuperClass{
}
class B extends SuperClass{
}
Now I have another method that want to access the getSt inherited method from A and B's object. Like I have a code like this in this method:
String s=objectOfA.getSt();
String s1=ObjectOfB.getSt();
I want to make this call generic, so in place of ObjectOfA,ObjectOfB I want to use something else so I can extend a single copy of this method in a class that can call it accordingly