题目内容

10、题示代码的功能为:对于一个存放Person对象的ArrayList进行循环遍历。并输出每个Person对象的idCard和userName 。public class Person{privateLong idCard;pirvateString userName;//以下是getter和setter方法//省略}List list=newArrayList<>();Person p1=new Person();p1.setIdCard(new Long(1001));p1.setUserName(“terry”);Person p2=new Person();p2.setIdCard(new Long(1002));p2.setUserName(“tom”);list.add(p1);list.add(p2);for( 位置① ){System.out.println(person.getIdCard()+”:”+person.getUserName());}那么位置①处的代码为()。

A. Listlist:person
B. Person person:list
C. Listlist:Person
D. Personperson:List

查看答案
更多问题

11、在JAVA中,LinkedList类和ArrayList类同属于集合框架类,下列()选项中的方法是LinkedList类有而ArrayList类没有的。

A. add(intindexObjecto)
B. remove(Objecto)
C. removeLast()
D. add(Objecto)

12、在JAVA中ArrayList类实现了可变大小的数组,便于遍历元素和随机访问元素,已知获得了ArrayList类的对象bookTypeList,则下列语句中能够实现判断列表中是否存在字符串“小说”的是()。

A. bookTypeList.get("小说");
B. bookTypeList.contains("小说");
C. bookTypeList.add("小说");
D. bookTypeList.remove("小说");

16、对Util.ArrayList描述正确的是()。

A. 集合被保证为不可变
B. 集合中的元素可按索引访问
C. 集合中的元素保证唯一性
D. 通过唯一的键访问集合中的元素

根据中文填空,所填单词首字母已给出。注意动词形式。1.白天还算暖和,但晚上就冷得难受了。The days are still warm but the evenings are getting c__________.2.她阔步走上站台。She s___________ onto the platform.3.学生在考试期间的压力可能会非常大。The pressure on students during exam time can be i____________.4.如果孩子入睡困难,父母会疲惫不堪。A child's sleep problems cause parents f___________.5.每年秋天都有两百多万只野鸭迁徙到这个湖。More than 2 million wild ducks m__________ to the lake each fall.6.当他的举止开始变得怪异时,他的同事们起了疑心。Colleagues became s____________ when he started acting strangely.7.她不愿意对媒体说什么,这很容易理解。Her r_____________ to talk to the press was quite understandable.8.该研究项目持续了好几年。The research program s____________ over several years.9.刚才她还在那里,一会儿工夫就不见了。One moment she was there, and the next she had v____________.10.12岁以下的孩童乘坐公共交通工具时必须有成人陪伴。Children under 12 must be a______________ by an adult when travelling by public t

答案查题题库