Java基础新大纲作业:集合接口与类方法及程序调试.pdfVIP

  • 2
  • 0
  • 约8.99千字
  • 约 6页
  • 2026-03-01 发布于北京
  • 举报

Java基础新大纲作业:集合接口与类方法及程序调试.pdf

A:简答题

1、请把我们讲解过的所有类中的方法在API中找到,并使用自己的话进行描述

2、请说明Map接口和Collection接口的区别

3、请写出Map集合的遍历方式

4、请说明HashMap和Hashtable的区别

5、请解释Collection与Collections的区别

6、请自己整理份集合知识点文档

B:看程序写结果(写出自己的分析理由),程序填空,改错,看程序写结果。

classCar{

privateStringbrand;//品牌

privateintyear;//制造年份

publicCar(){}

publicCar(Stringbrand,intyear){

this.brand=brand;

this.year=year;

}

publicvoidsetBrand(Stringbrand){

this.brand=brand;

}

publicStringgetBrand(){

returnbrand;

}

publicvoidsetYear(intyear){

this.year=year;

}

publicintgetYear(){

returnyear;

}

}

1、给出以下代码,请问该程序的运行结果?问题,请说明。

classTest{publicstaticvoidmain(String[]args){HashMap

Integer,Stringhm=newHashMapInteger,String();

hm.put(newInteger(23),Jim);hm.put(newInteger(23),Kevin);

SetIntegerkeys=hm.keySet();for(Integerkey:keys){String

value=hm.get(key);System.out.println(value);}}}

2、给出以下代码,已定义好Car类,请问该程序的运行结果?问题,请说明。

classTest{

publicstaticvoidmain(String[]args){

A:简答题

1、请把我们讲解过的所有类中的方法在API中找到,并使用自己的话进行描述

2、请说明Map接口和Collection接口的区别

3、请写出Map集合的遍历方式

4、请说明HashMap和Hashtable的区别

5、请解释Collection与Collections的区别

6、请自己整理份集合知识点文档

B:看程序写结果(写出自己的分析理由),程序填空,改错,看程序写结果。

classCar{

privateStringbrand;//品牌

privateintyear;//制造年份

publicCar(){}

publicCar(Stringbrand,intyear){

this.brand=brand;

this.year=year;

}

publicvoidsetBrand(String

文档评论(0)

1亿VIP精品文档

相关文档