package com.apryll.package2; public class sample2 { public static void main(String args[]) { sample2 objsample2 = new sample2(); objsample2.argCount(1, 2, 3, 4); } public void argCount(int num1, int num2, int... args) { System.out.println(num1); System.out.println(num2); System.out.println(args.length); } }
OP
1
2
2
Please Note the Last 2 which accounts for the array argument args as num1 and num2 does not account for array arguments
If the Code is like below then it would have been a error
public void argCount(int num1, int num2, int... args)