20182331 2019-2020-2,3《數據結構與面向對象程序設計》第2,3周學習總結

20182331 2019-2020-2,3《數據結構與面向對象程序設計》第2,3周學習總結html

1、教材學習內容總結
(一)、第二章學習總結:
1.字符串是由String類定義的對象
2.println輸出後光標移動到下一行,print不會
3.變量常量及他們的賦值
4.基本數據類型,和C的沒啥差距
5.5個算數運算符及其優先級和自增自減,賦值運算符
6.數據類型轉換:賦值類型轉換、提高類型轉換、強制類型轉換
7.Scanner類提供一些從不一樣數據源讀取各類類型數據的方法
(二)、第二章學習總結:
1.建立對象引用變量的聲明與初始化以及別名的概念
2.String類對象的長度和內容不可修改
3.包:JAVA標準類庫中的類,import聲明
4.Random類用來生成隨機數
5.Matn主要是基本數學函數,靜態方法
6.NumberFormat和DecimalFormat格式化信息輸出,printf輸出含有數值的格式字符串
7.一個包裝器表明一種具體的基本數據類型vim

2、教材學習中的問題和解決過程數據結構

問題1:靜態方法和非靜態方法有啥區別?
問題1解決方案:二者的生命週期不一樣。靜態方法的生命週期跟相應的類同樣長。而非靜態方法的生命週期和類的實例化對象同樣長。靜態方法能夠直接調用,類名調用和對象調用。可是非靜態方法只能經過對象調用。
問題2:Scanner scan = new Scanner(System.in)常常用可是它是啥意思?
問題2解決方案:調用Scanner類的方法,必須建立一個對象。Java中的對象使用new運算符來建立。dom

3、代碼調試中的問題和解決過程函數

問題1:使用Scanner類輸入數據時發生錯誤,提示InputMismatchException
問題1解決方案輸入類型與方法不匹配,將輸入語句修改爲與變量類型對應就能夠了
問題2::吃回車問題
問題2解決方案:當要輸入字符或字符串時,若是前面不是字符或字符串類型的輸入,那麼就會出現吃回車問題,輸入op=scan.nextLine(),將前者留在鍵盤緩衝區的回車吃掉學習

4、代碼託管
設計

5、上週考試錯題總結調試

1.If you want to output the text "hi there", including the quote marks, which of the following could do that? (若是你想輸出文本"hi there",包括引號在內,下面哪一個語句能夠作到?)
A . System.out.println("hi there");
B . System.out.println(""hi there"");
C . System.out.println(""hi there");
D . System.out.println(""hi there"");
E . none, it is not possible to output a quote mark because it is used to mark the beginning and ending of the String to be output (無,不可能輸出引號,由於它被用來標記字符串的開始和結束)
緣由:」是一個轉義序列,用於在字符串中放置引號,所以這裏使用它來輸出引號和字符串的其他分。
2.In order to compare int, float and double variables, you can use <, >, ==, !=, <=, >=, but to compare char and String variables, you must use compareTo( ), equals( ) and equalsIgnoreCase( ).
A . true
B . false
緣由:第一個我知道,但第二個和第三個我不知道
3.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
緣由:根據實驗二輸入加減運算符的推斷作的,可是我沒搞清轉化和取第一個字符的區別
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 (它能夠執行任何類型的數值,其結果始終是數值)
5.What is output with the statement System.out.println(x+y); if x and y are int values where x=10 and y=5? (若是x和y是int類型的數值,x=10,y=5,那麼語句System.out.println(x+y);的輸出是什麼?)
A . 15
B . 105
C . 10 5
D . x+y
E . An error since neither x nor y is a String (因x和y都不是字符串而引發的一個錯誤)
6.What is output with the statement System.out.println(""+x+y); if x and y are int values where x=10 and y=5? (若是x和y是int類型的數值,x=10,y=5,那麼語句System.out.println(""+x+y);的輸出是什麼?)
A . 15
B . 105
C . 10 5
D . x+y
E . An error since neither x nor y is a String (因x和y都不是字符串而引發的一個錯誤)
7.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");
緣由:四、五、六、7都是由於基礎只是不紮實而作錯的
其餘沒貼出來的錯題一部分是重複問題,一部分是因爲英語很差orm

6、結對互評
20182309 結對學習內容
結對學習內容:
重裝Linux
替換vimrc
切換源
比較C語言和Java
幫助分析錯誤htm

董其鵬: 由於我兩是上下鋪的關係,因此咱們是一塊兒學習,有問題一塊兒查資料,一塊兒解決,雖然他的基礎很差,可是他學的十分努力,出了bug先是本身解決,解決不了在過來和我商量。

7、學習進度條

代碼行數(新增/累積) 博客量(新增/累積) 學習時間(新增/累積) 重要成長
目標 5000行 30篇 400小時
第一週 729/838 2/4 47/67

《Java程序設計與數據結構教程(第二版)》

《Java程序設計與數據結構教程(第二版)》學習指導

相關文章
相關標籤/搜索