|
-
Nov 13th, 2002, 03:30 PM
#1
Multiple return values
I saw this question asked here by someone: "So if you're a real guru, do you know how to return multiple values from a method?" or something like that.
Happens that I need just now. I have a function that should return both a boolean and a String. I don't want to write a class for this.
I suppose I can't do this:
Code:
boolean method(String out)
{
out = "Hello there!";
}
as out is a reference to an object, but the = in the function will just change out to reference a different object, not actually changing the object (impossible for String) or the reference that was originally passed to the function.
As I am writing I've just stumbled upon the java.lang.ref package, I think it's what I need.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|