Can we mix normal parameter with var-arg parameter?

class VarArgMethod4
{
public static void m1(int...x,String s)
       {
for(int i:x)
System.out.print(i+" ");
System.out.println(s);
}
public static void main(String[] args)
{
m1("altaf");
m1(10,"altaf");
m1(10,20,"altaf");
}
}
/*
Output:- Compilation error
Explanation:- If we mix var-arg parameter with normal parameter then var-arg parameter should be
the last parameter otherwise it will rise compilation error.
*/

0 comments: