云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 面向对象程序设计技术复习题 docx

面向对象程序设计技术复习题 docx

  • 62 次阅读
  • 3 次下载
  • 2025/6/16 9:38:41

else return 3*a+x; }

publicint get() {return a;}

public static void main(String[] args) { XXK2 x=new XXK2(5); int y=x.f1(9); y+=x.get()*x.get();

System.out.println(\} }

7.

interface Shape { double area(); double girth(); }

class Rectangle implements Shape { inta,b;

public Rectangle(intaa, int bb) {a=aa; b=bb;} public double area() {return a*b;}

public double girth() {return 2*(a+b);} }

public class XXK3 {

public static void main(String[] args) { Shape x;

x=new Rectangle(6,10);

System.out.println(x.area()+\} }

8.

public class XXK4 {

public static void main(String[] args) { int []a=new int[6]; inti,s=0;

for(i=1; i

9.

class ABC { String name; double price;

public ABC(String na, double pr) {name=na; price=pr;} publicintcompareTo(ABC x) { if(price>x.price) return 1; if(price

public class XXK5 {

public static void main(String[] args) {

String []s={\double []d={3.8, 2.5, 3.2, 4.3, 5.2}; ABC []ar=new ABC[s.length]; inti,k=0;

for(i=0; i

if(ar[i].compareTo(ar[k])>0) k=i;

System.out.println(ar[k].name+\ } }

《面向对象程序设计技术》复习题答案

一、单项选择题 题号 答案 题号 答案 1 B 11 B 2 B 12 A 3 C 13 B 4 B 14 C 5 D 15 C 6 A 16 D 7 B 17 A 8 C 18 C 9 C 19 B 10 A 20 D

二、判断题(将正确答案填入下表中,正确打“√”,错误打“×”) 题号 答案 题号 答案 1 × 11 √ 2 √ 12 √ 3 × 13 √ 4 √ 14 × 5 √ 15 √ 6 √ 16 7 √ 17 8 √ 18 9 × 19 10 √ 20 × √ √ √ × 三、程序分析题

1.

输出结果:y=43 2.

输出结果:y=22 3.

运行结果:y=25 4.

输出结果:57.0, 255.0 5.

输出结果应为:max: 28min: 12

6. 输出结果:y=53 7. 输出结果:60.0, 32.0 8. 输出结果:s=30 9. 输出结果:grape 5.2

搜索更多关于: 面向对象程序设计技术复习题 docx 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

else return 3*a+x; } publicint get() {return a;} public static void main(String[] args) { XXK2 x=new XXK2(5); int y=x.f1(9); y+=x.get()*x.get(); System.out.println(\} } 7. interface Shape { double area(); double girth(); } class Rectangle implements Shape { inta,b; public Rectangle(intaa, int bb) {a=aa; b=bb;} public double are

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com