A simple Java program demonstrating the use of Variable Arguments Parameter List
Output of the program :
package com.hubberspot.objects.example; class VarArgument { void display(String message, String...names) { for(String name : names) System.out.println(message + name); } } public class VarArgsDemo { public static void main(String[] args) { VarArgument var = new VarArgument(); var.display("Hello " , "Hubberspot"); var.display("Welcome ", "Jonty", "Michelle", "Tsotsobe"); } }
Output of the program :