VarArgs:
Variable is declare inside the method’s argument.It is
called as Varargs.
Syntax:
return type method_name( return type…. Value).
Example:
public class JdkVarArgs
{
public static void main(String args[])
display();
display("hai","Welcome");
}
public static void display(String... values)//VarArg Method
{
System.out.println("Am Display method ");
for(String s:values)
{
System.out.print(s);
}
}
To learn more on java training in chennai or java tutorial
Output:
Am Display method
Am Display method
Hai Welcome
Variable is declare inside the method’s argument.It is
called as Varargs.
Syntax:
return type method_name( return type…. Value).
Example:
public class JdkVarArgs
{
public static void main(String args[])
display();
display("hai","Welcome");
}
public static void display(String... values)//VarArg Method
{
System.out.println("Am Display method ");
for(String s:values)
{
System.out.print(s);
}
}
To learn more on java training in chennai or java tutorial
Output:
Am Display method
Am Display method
Hai Welcome