Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing several variables back from a java class

Status
Not open for further replies.

FearsomeFastFemale

Programmer
Nov 19, 2002
23
GB
Hi,

I am new to java (from mainframe cobol) so forgive me if this is a basic question.

I want to call a java method with a string, and 2 intergers. (this I can do) I want to return, a return code of true/false, and 2 intergers (not the same 2 that went in)
It seams I can do it 3 ways

1) return 1 long string and the parse into the 3 parts.
2) return an array
3) have a nested class to define the return variables.

Option 3 seems to be the most logical to me,
Option 2 has been susgested to me locally. I dont like this as I think of an array as group of simaler objects, days of the week etc. and of the same type.
Option 1 just looks horrible.

What are your opinions, I want code that is efficant maintainable and readable.

 
3rd option.
Create a class that carries all of your data.
Also I suggest thinking your classes structure well because if you design them in a good way ,you will be able to use classes in other enviroment e.g. other projects etc. Salih Sipahi
Software Engineer.
City of Istanbul Turkey
ssipahi@yonbilgi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top