Following code gives compile time error like
'Method print(List) has the same erasure print(List) as another method in type MethodOverLoadingGenericExample'
public static void main(String[] args) {
}
public void print(List<Employee> empList){
System.out.println(empList);
}
public void print(List<Address> empList){
System.out.println(empList);
}
class Employee {
private String name;
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
}
class Address {
public int pincode;
public void setPincode(int pincode) {
this.pincode = pincode;
}
public int getPincode(){
return pincode;
}
}