20172329 2017-2018《程序设计与数据结构》第三周学习总结

学号 2017-2018-20172329 《程序设计与数据结构》第三周学习总结

教材学习内容总结

  • 这一章总体学习了类与对象的问题,了解描述Java标准如何按照包分组;
  • 学习了一些数学算法,可以进行乘方和开方的运算;
  • 了解了随机数的创造以及电话号码的产生;
  • 学习了格式化输出;

教材学习中的问题和解决过程

  • 问题1:
    对于String的理解:因为在第一二章学习的过程里,觉得string是一个固定的东西,并没有发现它的含义,在在第三章第一、二节的理解就出现了理解困难的问题。比如:“虽然String不是基础数据类型,但由于这总类型也是非常基础的”、“尽管已经声明了String型引用变量,但实际上还不存在Stirng对象。”这一系列频繁出现“尽管...但”,让我对于一个概念的理解很是困难。
  • 问题1解决方案:
    仔细研读教材,一句一个字的读,习惯划重点,我发现学习Java可以用画图的的方法解决很多问题。

书中的很多问题还有待解决,解决以后会及时补充上去。
PS:图片是上周的复习图,本周还没有完善。

代码调试中的问题和解决过程

  • 问题1:在编写电话号码练习题的过程,中间三位数字的编写很是让人困恼,用了很多办法还是不能按照要求打出来。

  • 问题1解决方案:老师首先交给我们一种方法,后来学长给我们发了如何去编写。

      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.5

      正确答案: 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类型,所以会发生运行时错误)

      正确答案: A     我的答案: B
    

原因:在除法只保留整数,float为浮点数写出0.0

  • 错题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 (它可以执行任何类型的数值,其结果始终是数值)

      正确答案: 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小时

  • 改进情况:加强对书的思考,书的理解。

posted @ 2018-03-24 23:53  lalalaouye  阅读(157)  评论(5编辑  收藏  举报