Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jason Perry   on Jul 17 In Java Category.

  
Question Answered By: Murad Bashara   on Jul 17

To return  more than one value from the method

1. use Exception ( method will treturn either excetion or return value )

public Object callMethod throws UserException

2. use composite object to return more than one Object


public ReturnObject callObject
{

ReturnObject ro = new ReturnObject();

ro.setResult( // vec , // hashtable ..... etc ) . // if the setResult
accepts Object as arguement

return ro ;

}

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on what is a "return a value" Or get search suggestion and latest updates.


Tagged: