JAVA编程思想课后习题答案

上传人:ni****g 文档编号:497310529 上传时间:2023-04-04 格式:DOC 页数:16 大小:73.50KB
返回 下载 相关 举报
JAVA编程思想课后习题答案_第1页
第1页 / 共16页
JAVA编程思想课后习题答案_第2页
第2页 / 共16页
JAVA编程思想课后习题答案_第3页
第3页 / 共16页
JAVA编程思想课后习题答案_第4页
第4页 / 共16页
JAVA编程思想课后习题答案_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《JAVA编程思想课后习题答案》由会员分享,可在线阅读,更多相关《JAVA编程思想课后习题答案(16页珍藏版)》请在金锄头文库上搜索。

1、Java编程思想(第四版)习题答案第二章 练习 1:public class PrimitiveTest 练习 2:public class HelloWorld 练习 3:public class ATNTest 练习 4:public class DataOnlyTest class DataOnly int i;double d;boolean b;void show() System、out、println(i);System、out、println(d);public static void main(String args) class ATypeName int i;double

2、 d;boolean b;void show() System、out、println(i); System、out、println(d);System、out、println(b);public static void main(String args) public static void main(String args) System、 out 、 println(Hello World!);static int i; static char c;public static void main(String args) System、out 、println(int = + i);Sy

3、stem、out 、println(char = + c); ATypeName a = new ATypeName();a、 i = 3;a、 d = 2、71828;a、 b = false;a、show();System、out、println(b);DataOnly data = new DataOnly(); data、 i = 3;data、 d = 2、71828;# / 18data、 b = false; data、show();练习 5:public class DOTest2 练习 6:public class StorageTest 练习 7: class Static

4、Test static int i = 47;class StoreStuff int storage(String s) class DataOnly int i;double d; boolean b;void show() public static void main(String args) System、out、println(i); System、out、println(d);System、out、println(b);DataOnly data = new DataOnly();data、 i = 234;data、 d = 2、1234545;data、 b = true;d

5、ata、show();public static void main(String args) return s、 length() * 2;StoreStuff x = new StoreStuff();System、out、println(x 、storage(hi);class Incrementable public class ITest 练习 8:class StaticTest class Incrementable public class OneStaticTest public static void main(String args) System、out、printin

6、(StaticTest、i= + StaticTest i);迁终樹邬锾羆餾StaticTest st1 = new StaticTest();StaticTest st2 = new StaticTest();System、out、println(st1 、i= + st1、i);System、out、println(st2 、i= + st2、i);Incrementable、increment();System、out 、println(After Incrementable 、increment() called: );飩诤页鸦 锸缍税。System、out、println(st1 、

7、i = + st1、i);System、out、println(st2 、i = + st2、i);Incrementable、increment();System、out 、println(After Incrementable 、increment called: );鉤躦憤鐮癤 點稳。System、out、println(st1 、i = + st1、i); System、out、println(st2 、i = + st2、i); st1、 i = 3;System、out 、println(After st1 、i = 3, );static void increment() Sta

8、ticTest、 i+; static int i = 47;public static void main(String args) System、out、printin(StaticTest、i= + StaticTest i);痪櫚赉诙鹞赢镜。StaticTest st1 = new StaticTest();StaticTest st2 = new StaticTest();System、out、println(st1 、i= + st1、i);System、out、println(st2 、i= + st2、i);Incrementable sf = new Incrementabl

9、e();sf、increment();System、out 、println(After sf 、increment() called: );塵綁躉純鯰鷙钬。System、out、println(st1 、i = + st1、i);System、out、println(st2 、i = + st2、i);Incrementable、increment();System、out 、println(After Incrementable 、increment called: );雋滨缍阵颖 鍵鉤。System、out、println(st1 、i = + st1、i);System、out、pri

10、ntln(st2 、i = + st2、i);static void increment() StaticTest、 i+; System、out、println(st1 、i = + st1、i);System、out、println(st2 、i = + st2、i);System、out、println(Create another StaticTest, st3、”);时娈谑萦闞珲开。StaticTest st3 = new StaticTest();System、 out、 println(st3 、 i = + st3、 i);练习 9:public class AutoboxTe

11、st 练习 10: public class CommandArgTest public static void main(String args) boolean b = false;char c = x;byte t = 8;short s = 16;int i = 32;long l = 64;float f = 0、 32f;double d = 0、 64;Boolean B = b;System、out 、println(boolean b = + b); System、out 、println(Boolean B = + B); Character C = c;System、ou

12、t 、println(char c = + c); System、out 、println(Character C = + C); Byte T = t;System、out 、println(byte t = + t);System、out 、println(Byte T = + T); Short S = s;System、out 、println(short s = + s);System、out 、println(Short S = + S); Integer I = i;System、out 、println(int i = + i);System、out 、println(Inte

13、ger I = + I); Long L = l;System、out 、println(long l = + l); System、out 、println(Long L = + L); Float F = f;System、out 、println(float f = + f);System、out 、println(Float F = + F); Double D = d;System、out 、println(double d = + d); System、out 、println(Double D = + D); public static void main(String args

14、) System、 out 、 println(args0 = + args0); System、out 、println(args1 = + args1); System、out 、println(args2 = + args2); 练习 11: public class Rainbow class AllTheColorsOfTheRainbow 练习 12: public class DocTest 练习 13-1:public class Documentation1 /* A field comment */ public int i;/* A method comment */ public void f() /* Entry poing to class & application 、* param args array of string arguments* throws exceptions No exceptions thrown*/public static void main(String args) System、 out 、 println(Hello, its: ); System、out 、println(new Date(); int an

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 商业计划书

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号