書中的不少問題還有待解決,解決之後會及時補充上去。
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小時
改進狀況:增強對書的思考,書的理解。