为什么
public class Excep {
public static void main(String[] args)throws Exception {
// TODO Auto-generated method stub
/**/
***List<Animal> list = new ArrayList<>();***
Animal dog=new Animal("yellow","Huang");
Animal cat=new Animal("white","Hua");
Animal rabbit=new Animal("black","Sheet");
加粗的那一行会编译错误:
Multiple markers at this line
- Cannot infer type arguments for
ArrayList<>
- The value of the local variable list is
not used
按理来说,ArrayList是List的子类,是可以编译成功的啊。。。