皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
阅读以下说明和Java代码,将 (n) 处的字句写在答题纸的对应栏内。 【说明】 Java.util包中提供了HashMap模板类,该模板类可以表示多个“键一值”对的集合,其中“键”的作用与普通数组中的索引相当,而“值”用作待存储和检索的数据。HashMap实现了Map接口。在Map接口中定义了put和get方法,put方法表示Map对象中加入一个“键-值”对,get方法则通过“键”来获取其对应的“值”。 下面的Java代码中使用了HashMap模板类,将编号为1001、1002、1003的员工信息插入到HashMap对象中,然后输入一个指定的员工编号,通过员工编号来获取员工的基本信息。员工编号为整型编码,而员工的基本信息定义为类employee。HashMap对象与员工对象之间的关系及存储结构如图5—2所示。 【Java代码】 import Java.util.*; class employee{ employee(String name,String phoneNumber,String address){ this.name=name; thi s.phoneNumber=phoneNumber ; this.address=address; } String name; String phoneNumber; String address; }; publ ic class jaVaMain{ public static void main(String[]args){ MapemployeeMap=new HashMap(Integer,employee>(); for(Integer employIndex=1001;employIndex<=1003;employIndex++){ String tmp=employlndex. (1 ) (); employeeMap. (2) (employIndex, (3) (”employee-”+ tmp,“85523927-” +tmp,”addresS-” +tmp) );//将员工编号和员工信息插入到employeeMap对 象中 ) int employeeNo=0; System.out.print(”请输入员工编号:”); Scanner S=new Scanner(System.in); employeeNo=.s.nextInt(); //从标准输入获得员工编号 employee result=employeeMap. (4)(employeeNo); if( (5) ==null)( System.out.println(”该员工编号不存在!”); return; System.out.println(“你所查询的员工编号为:”+employeeNo); System.out.printld(“该员工姓名:”+result.name); System.out.println(“该员工电话:”+result.phoneNumber); System.out.println(“该员工地址:“+result.address); } }
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【判断题】农产品营销将会结合互联网、市场需求衍生出更多的新玩法、新模式。( )
A.
正确
B.
错误
【单选题】根据下列文章,请回答 1~20 题。{Page Read the following text. Choose the best word(s) for each numbered blank and mark A,B ,C or D on ANSWER SHEET1. Generally speaking, a British is widely regarded as a quiet, shy...
A.
relaxed
B.
frustrated
C.
amused
D.
exhausted
【判断题】影响塑件尺寸精度的因素十分复杂,首先是模具制造的精度和塑料收缩率的波动,其次是模具的磨损程度,另外,在成型时工艺条件的变化、塑件成型后的时效变化、塑件的飞边等都会影响塑件的精度。
A.
正确
B.
错误
【简答题】Read unit 4 text A The Open Window carefully, and complete the summary of it with the following words. entertained, to his horror, runs off, nervous, hunted, killed, distract, socialize, at short not...
【单选题】理性认知的特点是
A.
主观性、具像性
B.
生动性、科学性
C.
抽象性、间接性
D.
形象性、直接性
【多选题】影响塑件尺寸精度的因素:
A.
模具的制造精度、磨损程度和安装误差
B.
塑料收缩率的波动以及成型时工艺条件的变化
C.
塑件成型后的时效变化
【单选题】当今美国第一大主导产业是
A.
汽车工业
B.
钢铁工业
C.
化学工业
D.
信息产业
【判断题】一二年生花卉的生命周期较短,但种类丰富,同样有长日照花卉。
A.
正确
B.
错误
【判断题】共模抑制比越大,电路抗干扰能力越弱。
A.
正确
B.
错误
【单选题】如发现室性早搏或室性心动过速,应首选:
A.
采用同步直流电复律
B.
肌肉或静脉注射阿托品0.5—1mg
C.
口服美西律15mg、普鲁卡因胺250—500mg或妥卡尼600mg
D.
静脉注射利多卡因50—100mgE应用洋地黄类、维拉帕米
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题