Method With varargs in Java


Source Code

public class MethodArgs {
    //Method With Varargs in Java
    public static void getNames(String... names) {
        for (String name : names)
            System.out.println(name);
    }
 
    public static void main(String args[]) {
        getNames("Ram", "Sam", "Ravi", "Kumar", "sara");
    }
}
 
To download raw file Click Here

Basic Programs



Learn All in Tamil © Designed & Developed By Tutor Joes