How to store different types of objects in ArrayList

前端 未结 5 2029
暗喜
暗喜 2021-01-25 22:20

I need to store different objects in the ArrayList. Objects are similar in nature but different and have different methods.

Circle c = new Circle();  
Cube s =          


        
5条回答
  •  无人及你
    2021-01-25 23:11

    ArrayList list = new ArrayList();
    
    
    

    you can call the all methods including Object class method.

    提交回复
    热议问题