Creating instance list of different objects

前端 未结 7 1487
自闭症患者
自闭症患者 2021-02-04 08:17

I\'m tring to create an arraylist of different class instances. How can I create a list without defining a class type? ()

List

        
7条回答
  •  野的像风
    2021-02-04 08:54

    If you can't be more specific than Object with your instances, then use:

    List employees = new ArrayList();
    
    
    

    Otherwise be as specific as you can:

    List employees = new ArrayList();
    

    提交回复
    热议问题