On Apr 3, 3:05 am, rob80...@aim.com wrote: > In the MyTestPassByReferenceProject, how do you know what the test method is > supposed to do: > > public class TestPassByReference{ > > public static void main(String[] args) { > > System.out.println("main:start"); > > // Create an array of integers andinitialize > // the array with 10, 11, and 12. > int [] ages = {10, 11, 12}; > > // Print array values. The arrayshould display > // 10, 11, 12 > for (int i=0;i<ages.length; i++ ){ > System.out.println(ages[i]); > } > > System.out.println("main:before calling the test method"); > > // Call test and pass references to array. > // Since the array is a reference type, what is > // being passed is a pointer to actual array. > test(ages); > > System.out.println("main:after calling the test method"); > > // Print array values again. It nowshould contain changed values. > // display the changed values. > for (int i=0;i<ages.length; i++ ){ > System.out.println(ages[i]); > } > > System.out.println("main:end"); > > } >From what you wrote nothing, since you did not passed precisely the test method. >From what I have in my archives, simply reading the code of the test method, it changes the values of the ages array.
Michèle -- To post to this group, send email to javaprogrammingwithpassion@googlegroups.com To unsubscribe from this group, send email to javaprogrammingwithpassion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en To unsubscribe, reply using "remove me" as the subject.