package Classes;
// Make methods that have unspecified number of parameters:pass an array of Objects
public class vararg5 {
public static void main(String args[]) {
myMethod(new Object[] { "value 1", new Integer(2), "value n" });
}
public static void myMethod(Object parms[]) {
for (int i = 0; i < parms.length; i++)
System.out.println(parms[i]);
}
}
got output like
value 1
2
value n |