Given: int[] myArray=newint[] {1, 2,3,4, 5}; What allows you to create a list from this array?()
A: List myList = myArray.asList();
B: List myList = Arrays.asList(myArray);
C: List myList = new ArrayList(myArray);
D: List myList = Collections.fromArray(myArray);
A: List myList = myArray.asList();
B: List myList = Arrays.asList(myArray);
C: List myList = new ArrayList(myArray);
D: List myList = Collections.fromArray(myArray);
举一反三
- int[] myArray = new int[] {1,2,3,4,5}; 以下哪个选项可以用一个数组创建一个列表?() A: List myList = myArray.asList(); B: List myList = Arrays.asList(myArray); C: List myList = new ArrayList(myArray); D: List myList = Collections.fromArray(myArray);
- 欲构造ArrayList类的对象,此类继承List接口,下列方法哪个是正确的? A: ArrayList mylist=new List() B: ArrayList mylist=new Object () C: List mylist=new List() D: List mylist=new ArrayList ()
- 欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?( ) A: ArrayList myList=new Object(); B: ArrayList myList=new List(); C: List myList=new ArrayList(); D: List myList=new List();
- 欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的 ( ) A: ArrayList myList=new Object(); B: List myList=new ArrayList(); C: ArrayList myList=new List(); D: myList=new List();
- 已知ArrayList继承了List接口,现预构造ArrayList类的一个实例,下列哪个方法是正确的() A: ArrayLIst<br/>myList = new Object(); B: List<br/>myList = new ArrayList(); C: ArrayList<br/>myList = new List(); D: List<br/>myList = new List();