20172329 2017-2018《程序設計與數據結構》第三週學習總結

學號 2017-2018-20172329 《程序設計與數據結構》第三週學習總結

教材學習內容總結

  • 這一章整體學習了類與對象的問題,瞭解描述Java標準如何按照包分組;
  • 學習了一些數學算法,能夠進行乘方和開方的運算;
  • 瞭解了隨機數的創造以及電話號碼的產生;
  • 學習了格式化輸出;

教材學習中的問題和解決過程

  • 問題1:
    對於String的理解:由於在第一二章學習的過程裏,以爲string是一個固定的東西,並無發現它的含義,在在第三章第1、二節的理解就出現了理解困難的問題。好比:「雖然String不是基礎數據類型,但因爲這總類型也是很是基礎的」、「儘管已經聲明瞭String型引用變量,但實際上還不存在Stirng對象。」這一系列頻繁出現「儘管...但」,讓我對於一個概念的理解非常困難。
  • 問題1解決方案:
    仔細研讀教材,一句一個字的讀,習慣劃重點,我發現學習Java能夠用畫圖的的方法解決不少問題。

書中的不少問題還有待解決,解決之後會及時補充上去。
PS:圖片是上週的複習圖,本週尚未完善。html

代碼調試中的問題和解決過程

  • 問題1:在編寫電話號碼練習題的過程,中間三位數字的編寫非常讓人困惱,用了不少辦法仍是不能按照要求打出來。
  • 問題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:這周安裝學習了IDEAL,在剛剛下好的時候,老是不能把碼雲裏的代碼克隆下來。
  • 問題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

    緣由:在網上找到正確答案,我還選錯了。

其餘(感悟、思考等,可選)

  • 忽然發現Java學習變得開始困難了,並且增長了學習IDEL的過程,調試的過程很是的複雜,一是由於是全英文看不太懂(ps:加了漢化包之後纔看懂一些,英語真的很重要),二是由於第一次接觸這個,不是很是懂,常常問學長和同窗纔將本身碼雲上的代碼錯誤所有都修改正確,這個過程看似簡單其實其中有不少神奇的地方。
  • Java學習了已經三週了,這種自主學習的過程既能發現本身的問題,並且還能夠培養咱們的學習能力,可是特別考驗一我的的能力。
  • 大一下學期,忽然發現時間不夠用了,感受天天都是在上課,寫做業,敲代碼,班裏還有人刷代碼,我以爲這徹底是給別人在學,本身學的也沒有多少。

學習進度條

代碼行數(新增/累積) 博客量(新增/累積) 學習時間(新增/累積)
目標 5000行 30篇 400小時
第一週 156/156 1/1 15/15
第二週 217/371 1/2 20/35
第三週 233/604 1/3 20/55

參考:

Java程序設計

  • 計劃學習時間:25小時

  • 實際學習時間:20小時

  • 改進狀況:增強對書的思考,書的理解。

相關文章
相關標籤/搜索