书中的不少问题还有待解决,解决之后会及时补充上去。
PS:图片是上周的复习图,本周尚未完善。html
问题1解决方案:老师首先交给咱们一种方法,后来学长给咱们发了如何去编写。git
public class telephonenumber{ public static void main(String[] args) { DecimalFormat decimalFormat = new DecimalFormat("000"); DecimalFormat decimalFormat1 = new DecimalFormat("0000"); Random random = new Random(); int num = random.nextInt(8); int num1 = random.nextInt(8); int num2 = random.nextInt(8); int num3 = random.nextInt(656); int num4 = random.nextInt(10000); System.out.println("电话号码:" + num + num1 + num2 + "-" + decimalFormat.format(num3) + "-" + decimalFormat1.format(num4)); }}
问题2解决方案:发现自已没有安装git(windows版),使得不能运行。算法
错题1
Consider the following statement:
System.out.println("1 big bad wolf\t8 the 3 little pigs\n4 dinner\r2night");
This statement will output ________ lines of text (思考下面的语句,该语句将输出___行文本)
A.1
B.2
C.3
D.4
E.5windows
正确答案: B 个人答案: C
缘由:在后面“night”把“n”又算了一遍。数据结构
错题2
What value will z have if we execute the following assignment statement? float z = 5 / 10; (若是咱们执行下面的赋值语句,获得的z将会是什么值?)
A .z will equal 0.0 (z将等于0.0)
B .z will equal 0.5 (z将等于0.5)
C .z will equal 5.0 (z将等于5.0)
D .z will equal 0.05 (z将等于0.05)
E .none of the above, a run-time error arises because z is a float and 5 / 10 is an int (以上都不对,由于z是float类型,5 / 10是int类型,因此会发生运行时错误)dom
正确答案: A 个人答案: B
缘由:在除法只保留整数,float为浮点数写出0.0ide
错题3
A cast is required in which of the following situations? (下列哪一种状况须要强制转换?)
A .using charAt to take an element of a String and store it in a char (使用charAt来获取字符串元素并将其存储为char类型)
B .storing an int in a float (将一个int类型的数存储为float类型)
C .storing a float in a double (将一个float类型的数存储为double类型)
D .storing a float in an int (将一个float类型的数存储为int类型)
E .all of the above require casts (以上全部状况都须要强制转换)学习
正确答案: D 个人答案: E缘由:太太重视没有忽略精确度。
错题4
Which of the following is true regarding the mod operator, %? (关于求余运算符%,下面哪项是正确的?)
A .It can only be performed on int values and its result is a double (它只能执行int类型的数值,其结果是double类型的数)
B .It can only be performed on int values and its result is an int (它只能执行int类型的数值,其结果也是int类型的数)
C .It can only be performed on float or double values and its result is an int (它只能执行float或者double类型的数值,其结果是int类型的数)
D .It can only be performed on float or double values and its result is a double (它只能执行float或者double类型的数值,其结果是double类型的数)
E .It can be performed on any numeric values, and the result always is numeric (它能够执行任何类型的数值,其结果始终是数值)ui
正确答案: E 个人答案: B缘由:对于求余符号的理解不够透彻。
错题5
If you want to store into the String name the value "George Bush", you would do which statement? (若是你想把"George Bush"这个值存储为字符串类型的名字,你会执行那条语句?)
A .String name = "George Bush";
B .String name = new String("George Bush");
C .String name = "George" + " " + "Bush";
D .String name = new String("George" + " " + "Bush");
E .Any of the above would work (上述均可以完成)设计
正确答案: E 个人答案: B缘由:由于常常用B,因此没有去考虑其余的答案。
错题6
What value will z have if we execute the following assignment statement?
int z = 50 / 10.00; (若是咱们执行下面的赋值语句,z将获得什么值?)
A .5
B .5.0
C .50
D .10
E .none of the above, a run-time error arises because z is an int and 50 / 10.00 is not (以上皆错,因z是一个整型数而50 / 10.00不是,会产生运行时错误)
正确答案: E 个人答案: B缘由:这道题打错,手抖。
错题7
In order to create a constant, you would use which of the following Java reserved words? (为了建立一个常量,你会使用下列Java保留字中的哪个?)
A .private
B .static
C .int
D .final
E .class
正确答案: D 个人答案: C缘由:这道题打错,我发现本身手真的抖。
错题8
A variable of type boolean will store either a 0 or a 1. (Boolean类型的变量将被存储为0或1)
A .true
B .false
正确答案: B 个人答案: A
错题9
You cannot cast a String to be a char and you cannot cast a String which stores a number to be an int, float or double. (你不能将字符串强制转换为char类型,也不能将一个字符串强制转换为int、float或double类型。)
A .true
B .false
正确答案: A 个人答案: B
缘由:在网上找到正确答案,我还选错了。
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | |
---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 |
第一周 | 156/156 | 1/1 | 15/15 |
第二周 | 217/371 | 1/2 | 20/35 |
第三周 | 233/604 | 1/3 | 20/55 |
计划学习时间:25小时
实际学习时间:20小时
改进状况:增强对书的思考,书的理解。