Here is a quick example which creates a String array and populates it with a string that has been parsed. Also notice how the string array is being passed as an arguement to the openVault(String[] vault) method which has a string array defined as a parameter.
Code:
import java.util.*;
class FortKnox{
public static void main(String[] args){
String s = "bronze silver gold ";
StringTokenizer st = new StringTokenizer(s);
String[] vault = new String[3];
int index = -1;
while(st.hasMoreTokens()){
String token = st.nextToken();
vault[++index] = token;
}
openVault(vault);
}
public static void openVault(String[] vault){
System.out.print("The contents of the vault are");
System.out.println();
for(int i = 0; i < vault.length; i++){
System.out.println(vault[i]);
}