Java Varargs Examples
1. What is Varargs in Java? Varargs (variable arguments) is a feature introduced in Java 1.5. It allows a method take an arbitrary number of values as arguments. public static void main(String[] args) { print("a"); print("a", "b"); print("a", "b", "c"); } public static void print(String … s){ for(String a: s) System.out.println(a); }public static void … Read more