Question: > 
> **Possible Duplicate:**  
> 
> [How to return multiple objects from a Java method?](https://stackoverflow.com/questions/457629/how-to-return-multiple-objects-from-a-java-method) 
> 
> 
> 

Is there any way to return multiple defferent objects from a Java method

for example i want return string ,int ,object ,.. etc

thanks

Answer: 
You can return a `Map<Class, Object>` containing the resulting objects' types mapped with their values.

```
public Map<Class, Object> doSomeStuff(){
  Map<Class, Object> map = HashMap<Class, Object>();
  map.put(String.getClass(), "This is an example");
  map.put(Object.getClass(), new Object());
  //...
  return map;
}

// You can then retrieve all results by
String stringVal = map.get(String.getClass());
Object objectVal = map.get(Object.getClass());

```
Not explicitly. You can make your own class that contains eveything, and return that, or you can return some form of `Object` array (`Object[]`) or list (like an `ArrayList`) that contains everything, but that is not recommended.

EDIT: Also you can use generics as mentioned above, this falls under the category of making your own class, thought I would mention it seperately too though.