网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
能够遍历泛型List〈Integer〉al中的所有元素的语句是哪项?()
A.for(Integeri:al)
B.for(i:al)
C.for(al)
D.forEach(Integeri:al)
参考答案
更多 “ 能够遍历泛型List〈Integer〉al中的所有元素的语句是哪项?() A.for(Integeri:al)B.for(i:al)C.for(al)D.forEach(Integeri:al) ” 相关考题
考题
定义一个List对象list,使用ArrayList的构造方法进行初始化,并且要求list中必须全部存放Integer类型的对象,以下语句正确的是()。A.List list = new ArrayList<Integer>();B.List list = new ArrayList ();C.List<Integer> list = new ArrayList<Integer>();D.ArrayList<Integer> list = new List<Integer>();
考题
定义一个List对象list,使用ArrayList的构造方法进行初始化,并且要求list中必须全部存放Integer类型的对象,以下语句正确的是()。A.List list = new ArrayList ();B.List list = new ArrayList<Integer>();C.ArrayList<Integer> list = new List<Integer>();D.List<Integer> list = new ArrayList<Integer>();
考题
创建一个只能存放String的泛型ArrayList的语句是哪项?()A.ArrayList<int> al=new ArrayList<int>();B.ArrayList<String> al=new ArrayList<String>();C.ArrayList al=new ArrayList();D.ArrayList al =new List();
考题
创建一个只能存放String的泛型ArrayList的语句是哪项?A.ArrayList<String> al=new ArrayList<>();B.ArrayList al=new ArrayList<>();C.ArrayList al=new ArrayList();D.ArrayList al=new List();
考题
定义一个List对象list,使用ArrayList的构造方法进行初始化,并且要求list中必须全部存放Integer类型的对象,以下语句正确的是()。A.List list = new ArrayList ();B.List list = new ArrayList<Integer>();C.List<Integer> list = new ArrayList<Integer>();D.ArrayList<Integer> list = new List<Integer>();
考题
不能使用普通的for循环语句遍历数组中的所有元素。
热门标签
最新试卷