In this code I have taken an overloaded method named show() with vararg. One is having int type vararg and the other is having float type vararg. When the other vararg is float then no error is there. But when it is replaced by boolean the system is giving an error. The code for both is given below.
//code with float vararg class A { void show(int ...x) { System.out.println("show with int"); } void show(float ...x) { System.out.println("show with float"); } } class B_float { public static void main(String a[]) { A ob=new A(); ob.show(); } } /code //code with boolean type vararg class A { void show(int ...x) { System.out.println("show with int"); } void show(boolean ...x) { System.out.println("show with float"); } } class B_bool { public static void main(String a[]) { A ob=new A(); ob.show(); } }