+ 1
Where is The Error.." Exampleprg(String... person) { " is that line not valid.
class Exampleprg { Exampleprg(String... person) { for (String name : person) { System.out.println("Hellow Mr. " + name); } } } public class VarArgs { public static void main( String args[]) { Exampleprg("Ayush","Sammy","Singh","Kumar"); } } // Output: // Hellow Mr. First Args. // Hellow Mr. Second Args. // Hellow Mr. nth Args.
1 Odpowiedź
0
you need create an object, by 'new' command
// Exampleprg("Ayush","Sammy","Singh","Kumar");
new Exampleprg("Ayush","Sammy","Singh","Kumar");