View Single Post
  #1 (permalink)  
Old 07-31-2007, 01:11 PM
Syed.muddasir Syed.muddasir is offline
Member
 
Join Date: Jul 2007
Posts: 4
Syed.muddasir is on a distinguished road
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");
}
Reply With Quote
Sponsored Links