|
Overloading methods dynamically
Hi everyone im new to this forum and here is my problem...
As shown in the code i have two overloaded methods which accepts a Double and string argument but i have an incoming object of unknown instace type
How can i invoke the method printObject() dynamically.
Thanks in advance...
public class Test {
public static void printObject(Double arg){
System.out.println("Double" + arg);
}
public static void printObject(String arg){
System.out.println("String" + arg);
}
public static void main(String args[])
{
Object one = new Double(100);
Object two = new String ("hello");
}
|