Solved

java function for pass values back

Posted on 2006-11-06
5
236 Views
Last Modified: 2010-03-31
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
Comment
Question by:lilyyan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
owenli27 earned 80 total points
ID: 17883734
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
 

Author Comment

by:lilyyan
ID: 17883802
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
 
LVL 9

Expert Comment

by:owenli27
ID: 17883863
correct
0
 
LVL 9

Expert Comment

by:owenli27
ID: 17883883
Java manipulate objects by reference, and all object variables are references.
0
 

Author Comment

by:lilyyan
ID: 17883991
clear : )
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question