I would like to call a method which could potentially take on different versions, i.e. the same method for input parameters that are of type:
Yes, please be more specific about what you want to achieve. From your description I suggest you have a look at Java generics where you could write something like this:
class SomeClass {
GenericType val;
void setValue(GenericType val) {
this.val = val;
}
GenericType getValue() {
return val;
}
public static void main(String[] args) {
SomeClass myObj = new SomeClass();
myObj.setValue(5);
System.out.println(myObj.getValue());
SomeClass myObj2 = new SomeClass();
myObj2.setValue("hello?!");
System.out.println(myObj2.getValue());
}
}