Java Reference
In-Depth Information
LISTING 8.11
//********************************************************************
// VariableParameters.java Author: Lewis/Loftus
//
// Demonstrates the use of a variable length parameter list.
//********************************************************************
public class VariableParameters
{
//-----------------------------------------------------------------
// Creates two Family objects using a constructor that accepts
// a variable number of String objects as parameters.
//-----------------------------------------------------------------
public static void main (String[] args)
{
Family lewis = new Family ("John", "Sharon", "Justin", "Kayla",
"Nathan", "Samantha");
Family camden = new Family ("Stephen", "Annie", "Matt", "Mary",
"Simon", "Lucy", "Ruthie", "Sam", "David");
System.out.println(lewis);
System.out.println();
System.out.println(camden);
}
}
OUTPUT
John
Sharon
Justin
Kayla
Nathan
Samantha
Stephen
Annie
Matt
Mary
Simon
Lucy
Ruthie
Sam
David
Search WWH ::




Custom Search