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");
        
    }


-- 
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

Reply via email to