20172319 2018.03.12-19 《程序設計與數據結構》第2周學習總結
學號 20172319 2018.03.12-19 《程序設計與數據結構》第2周學習總結
教材學習內容總結
- 1.字符串:基本定義;print與println方法的區別;字符串的拼接;轉義序列的應用。
- 2.變量與賦值:變量;常量;賦值語句。
- 3.基本數據類型:四整二浮點一字符一布爾。
- 4.表達式:運算符的種類及其使用規則。
- 5.數據類型轉換:基本數據類型間的轉換(擴展及壓縮);數據轉換方式:賦值(只能擴展)、提升、強制。
- 6.交互式程序:Scanner 類。
教材學習中的問題和解決過程
- 問題1:怎麽看轉義序列中的\t
- 問題1解決方案:通過百度搜索;\t是制表符,相當於tab鍵,一個tab等同於8個空格(然而還是不懂8個空格就怎麽制表了),後來終於找到制表符的定義:產生一定距離的空白,使文本看上去像一個表格。 ?? (行行行,你帥你說的都對)
- 問題2:交互式程序中關於nextInt()、next()和nextLine()的理解
- 問題2解決方案:剛開始玩時確實遇到點問題,但後來能敲了也就不大想理了(其實是作業太多沒做完 ?? );後面聽老鐵提到了,藍墨雲上也有人提起,好好查了一下關於nextInt()、next()和nextLine()的理解。
代碼調試中的問題和解決過程
- 問題1:敲代碼的常見問題(空格、符號漏敲,變量忘記定義……)
問題1解決方案:個人習慣還沒養成/代碼太多, 想趕快敲完 (不存在的-做完習題後深有體會)/練的還不足量
- 問題2:編寫的代碼有錯誤
問題2解決方案:一時難以發現,只有通過機器不斷提示、運行程序出現錯誤或與題目不相符的情況後才加以改正
代碼托管
- 看到數字有木有很好奇 ?? git add了不想上傳的,結果去網絡上找方法,結果看到了一個revert皮了一波很快樂(剛敲的157行不見了 ?? )至於後面:重敲唄,就當練習了。
上周考試錯題總結
- 錯題1:
- The ability to directly obtain a stored item by referencing its address is known as (通過引用地址直接獲得存儲項的能力被稱為___)
- A .random access (隨機存取)
- B .sequential access (順序存取)
- C .read-only access (只讀訪問)
- D .fetch access (獲取訪問)
- E .volatility (易變性)
- 原因:不懂瞎蒙的。
理解情況:直接和隨機訪問有時是一個意思。
- 錯題2:
- It is important to dissect a problem into manageable pieces before trying to solve the problem because (試圖解決問題之前,把一個問題分解成可控制的幾部分是很重要的,因為)
- A .most problems are too complex to be solved as a single, large activity (大多數問題太復雜,以至於不能作為一個單獨大型的活動來解決)
- B .most problems are solved by multiple people and it is easy to assign each piece to a separate person (大多數問題都是由很多人解決的而且把每一部分分配給不同的人是很容易的)
- C .it is easier to integrate small pieces of a program into one program than it is to integrate one big chunk of code into one program (將程序的小部分整合到一個程序中比將一大塊代碼整合到一個程序中更容易)
- D .our first solution may not solve the problem correctly (我們的第一個方案可能無法正確解決問題)
- E .all of the above (以上皆是)
- 原因:熱靜分析,每個都有道理(其實課本這裏並沒有仔細看 ?? )
理解情況:一系列相關的小任務解決了,大任務就解決了。
- 錯題3:
- In the following list, which statement is not true regarding Java as a programming language? (關於Java這種程序設計語言,下面的哪種說法是不正確的?)
- A .It is a relatively recent language, having been introduced in 1995 (它是一種相對現代的語言,於1995年被引入)
- B .It is a language whose programs do not require translating into machine language before they are executed (它是一種執行程序前不需要被轉換成機器語言的語言)
- C .It is an object-oriented programming language (它是一種面向對象的程序設計語言)
- D .It is a language that embraces the idea of writing programs to be executed using the World Wide Web (這種語言可以使用萬維網來編寫要執行程序的想法)
E .All of the above are true (以上說法都是正確的)
- 原因:忘了,可能但是腦子抽了。
理解情況:不先解釋成機器語言是給鬼看哦 ?? (電腦是傻瓜,機器看不懂也就執行不出來)
- 錯題4:
- Comments should (註釋應該)
- A .rephrase the code it explains in English (用英語復述它解釋的代碼)
- B .be insightful and explain what the instruction‘s intention is ( 有深刻見解並解釋指令的意圖是什麽)
- C .only be included in code that is difficult to understand (僅僅包含在難以理解的代碼中)
- D .be used to define variables whose names are not easy to understand (被用於解釋難以理解的變量名稱)
E .all of the above (以上皆是)
- 原因:題目講得太玄了
理解情況:嗯,B說的有道理
- 錯題5:
- Which of the following is not syntactically legal in Java? (在Java中,下列哪一條語法不合法?)
- A .public class Foo
- B .System.out.println("Hi");
- C .{ }
- D .s t a t i c main(String[ ] args)
E .only B is legally valid, all of the rest are illegal (只有B是合法的,其余都不合法)
- 原因:接觸太少,對書中所述並沒有固化
理解情況:空格分隔開了,編譯器不會識別
- 錯題6:
- Which of the following is a legal Java identifier? (下面哪個是合法的Java標識符?)
- A .i
- B .class
- C .ilikeclass!
- D .idon‘tlikeclass
E .i-like-class
原因及理解情況:哦,class是保留字,無法充當標識符。
- 錯題7:
- A unique aspect of Java that allows code compiled on one machine to be executed on a machine of a different hardware platform is Java‘s (Java的獨特之處在於其___,它允許在一臺機器上編譯的代碼在不同的硬件平臺上執行)
- A .bytecodes (字節碼)
- B .syntax (語法)
- C .use of objects (所使用的對象)
- D .use of exception handling (所使用的異常處理)
E .all of the above (以上皆是)
原因及理解情況:Java程序的翻譯過程是首先將它編譯成字節碼,它在體系結構上是中立的(也就是說,無論架構平臺是什麽,都可以使用它們)。要執行該程序,字節碼必須由Java編譯器進一步編譯或由Java虛擬機解釋。
- 錯題8:
- Which of the following is true regarding Java syntax and semantics? (關於Java的語法和語義,下列哪一項是正確的?)
- A .a Java compiler can determine if you have followed proper syntax but not proper semantics (Java編譯器可以判定你是否遵循正確的語法,但不能判定正確的語義)
- B .a Java compiler can determine if you have followed proper semantics but not proper syntax (Java編譯器可以判定你是否遵循正確的語義,但不能判定正確的語法)
- C .a Java compiler can determine if you have followed both proper syntax and semantics (Java編譯器可以判定你是否遵循正確的語義和語法)
- D .a Java compiler cannot determine if you have followed either proper syntax or semantics (Java編譯器不能判定你是否遵循正確的語義或語法)
E .a Java compiler can determine if you have followed proper syntax and can determine if you have followed proper semantics if you follow the Java naming convention rules (如果你遵循Java的命名規範,Java編譯器就可以判定你是否遵循正確的語法,並且可以判定你是否遵循正確的語義)
原因及理解情況:機器是個傻子,我們讓它幹嘛就幹嘛,語法有錯機器可以指出,語義有誤它無法思考判斷。
- 錯題9:
- Which of the following would be a good variable name for the current value of a stock? (下面哪個是關於變量“current value of a stock”的最佳命名?)
- A .curstoval
- B .theCurrentValueOfThisStockIs
- C .currentStockVal
- D .csv
E .current
原因及理解情況:光簡潔還不夠,還得讓人明白它背後的含義。
其他(感悟、思考等,可選)
- Java的學習中光有做中學還不夠,你還得學會思考,不然敲得再多,那也只是會敲,而不是懂敲,編程是先明白自己想幹嘛,才去為這個目的而不斷前行,而不跟只笨鷹一樣,飛了很遠,卻不知自己要去哪。
- 什麽都要試一下,千萬不能因為它會讓你損失代碼就不做,代碼沒了可以重敲,但能接觸新的東西也是一件蠻有趣的事。
學習進度條
代碼行數(新增/累積) | 博客量(新增/累積) | 學習時間(新增/累積) | 重要成長 | |
---|---|---|---|---|
目標 | 5000行 | 30篇 | 400小時 | |
第一周 | 202/202 | 1/2 | 15/15 | 積極主動敲代碼 |
第二周 | 490/692 | 1/3 | 18/33 | 善於思考 |
20172319 2018.03.12-19 《程序設計與數據結構》第2周學習總結