File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes return 2 strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "return 2 strings" Watch "return 2 strings" New topic

return 2 strings

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
I got a function, and I want to return 2 string? What should I do?
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
You could return a:
1. String []
2. List containing your Strings
3. a user-defined class that aggregates 2 Strings
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Or a single string that is the concatenation of the two desired return values seperated by some character or character sequence.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: return 2 strings
It's not a secret anymore!