Can anyone please guide me how to execute doIt() on an int argument , if I already have var agrs argument method . The compilor refused to compile with an error . I mean I want both 1 and 2 to work ... Please point the error.
doIt(int... params) method takes in array of ints and its size would depend on number of ints you pass. doIt(int params) also takes an array of int and you cannot define 2 methods with same signature in same class, therefore you get an error saying doIt(int... p) is already defined in class.