source code variable argument method
package funds;
public class SimpleVararg {
void display(int... args){
for(int i=0;i<args.length;i++)
System.out.println(args[i]);
}
public static void main(String args[]){
SimpleVararg f=new SimpleVararg();
f.display(10,20,30,40,50);
f.display(100,200);
f.display(1);
}
}
output:
10
20
30
40
50
100
200
1
0 comments:
Post a Comment