• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

java function for pass values back

Hello,

guess i stocked by a simple question.

Suppose in a java class:
public class testName{

LinkedList list1, list2, list3

 list1 = value1;
 list2 =value2;
 list3 = value3;

private void searchList (list1, list2, list3 ){
LinkedList list1temp = list1,
                 list2temp = list2,
                 list3temp = list3;

// do some process for the three lists, then their there values will be changed

}

my question is: how can i pass the changed values back for list1, list2, list3, if i use return statement , only one value can be returned at one time.

Thanks very much for your reply,

lilyyan
0
lilyyan
Asked:
lilyyan
  • 3
  • 2
1 Solution
 
owenli27Commented:
They are passed by reference and you don't have to return them back to where you call fucntion. They are updated after void function end.
0
 
lilyyanAuthor Commented:
hi, that's what i'm thinking.

when you say "passed by reference " , this can only be applyed to certain data types, not for primary data type, for example: int, right?
0
 
owenli27Commented:
correct
0
 
owenli27Commented:
Java manipulate objects by reference, and all object variables are references.
0
 
lilyyanAuthor Commented:
clear : )
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now