• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • 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
 
Weiping DuSenior Web DeveloperCommented:
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
 
Weiping DuSenior Web DeveloperCommented:
correct
0
 
Weiping DuSenior Web DeveloperCommented:
Java manipulate objects by reference, and all object variables are references.
0
 
lilyyanAuthor Commented:
clear : )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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