How do I enter parameters for an ArrayList in BlueJ?

前端 未结 2 1046
故里飘歌
故里飘歌 2021-01-13 06:50

In BlueJ, if I write a method that takes an array as a parameter, then when I want to test that method with a method call I have to enter the elements with curly braces, so:

2条回答
  •  甜味超标
    2021-01-13 07:48

    Arrays.asList("1", "2", "3");
    

    Will return a List and not a ArrayList.

    Your methods' parameters should always be the interface and not the implementation.

提交回复
热议问题