View Single Post
  #2 (permalink)  
Old 12-30-2007, 06:27 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Generics
Hello eva.

How about using objects of instance Object. Like:
Code:
public static Object startProcess(Object a) { //Todo return null; }
You can then use casting to get the correct data type depending on what you want to do. To implement this method, you will need to use the instanceof keyword. For example:
Code:
public static Object startProcess(Object a) { // Handel if it is a String if (a instanceof String){ String aString = (String) a; // Do something to aString } return aString; }
I hope this helped.
__________________
If your ship has not come in yet then build a lighthouse.
Reply With Quote