return new Bean1<Bean2>(temp);
}
}
public static Bean1<? extends Bean2> getWildcardExtends(Bean1<? extends Bean2> arg) {
Bean2 item = arg.getItem();
if(item instanceof Bean3) {
Bean3 temp = new Bean3();
temp.setName("Hello "+item.getName());
temp.setAddress("New "+((Bean3)item).getAddress());
return new Bean1<Bean3>(temp);
} else if(item instanceof Bean31) {
Bean31 temp = new Bean31();
temp.setName("Hello "+item.getName());
temp.setAddress("New "+((Bean31)item).getAddress());
return new Bean1<Bean31>(temp);
} else {
Bean2 temp = new Bean2();
temp.setName("Hello "+item.getName());
return new Bean1<Bean2>(temp);
}
}