1 d arrays :: passing by reference
import java.io.*;
public class ArrayMethodII
{
public static void main (String[] args) throws IOException
{
int golf[] = new int [3];
getScores (golf); // populate from the keyboard
showScores (golf); // show to screen
} // main method
public static void getScores (int a[]) throws IOException
{
BufferedReader or = new BufferedReader (new InputStreamReader (System.in));
for (int i = 0 ; i < a.length ; i++)
{
System.out.println ("Enter the score for hole # " + (i + 1));
a [i] = Integer.parseInt (or.readLine ());
}
} // end of getScores
public static void showScores (int scoreList[])
{
System.out.print ("The scores are: ");
for (int i = 0 ; i < scoreList.length ; i++)
{
System.out.print (" ");
System.out.print (scoreList [i]);
}
}// end of showScores
}