Varargs was added in Java 5 and the syntax includes three dots … (also called ellipses).
Following is a program showing how to handle Variable arguments in Java :
}
Following is a program showing how to handle Variable arguments in Java :
public class testingVarargs {public static void main(String args[]) { testFunction(1234, "India", "Delhi"); testFunction(2345, "United States", "Mumbai", "kolkata"); } public static void testFunction(int some, String... args) { System.out.print("\n" + some); for(String arg: args) { System.out.print(", " + arg); } }}
No comments:
Post a Comment