20172318 2017-2018-2 《程序设计与数据结构》第4周学习总结

20172318 2017-2018-2 《程序设计与数据结构》第4周学习总结

教材学习内容总结

这周内容多,要学习两章的内容,实例主要是第四章的Die和Accont类以及第七章的RationNumber,Student,Address,Question类等

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

  • 问题1:对于toString不理解
  • 问题1解决方案:发现这个方法与用println显示是紧密相连的,定义一个toString方法可以让println方法显示所定义对象想要的信息
  • 问题2:对RationNumber类中reduce不理解
  • 问题2解决方案:通过注释以及结合代码了解到reduce方法让分数返回最简形式

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

  • 问题1:isantique方法使用Boolean值,但对于这个值的使用方法不清楚

  • 问题1解决方案:

  • 问题2:对于7.4中的误差寻找不到有效的表示方法

  • 问题2解决方案:

代码托管

上周考试错题总结

  • 错题1
    If two variables contain aliases of the same object then
    A . the object may be modified using either alias
    B . the object cannot be modified unless there's but a single reference to it
    C . a third alias is created if/when the object is modified
    D . the object will become an "orphan" if both variables are set to null
    E . answers A and D are correct
    别名提供了一种可以修改对象的方法。如果这两个变量被设置为null,那么对象不被任何变量引用(通过任何别名),它实际上变成了一个“孤儿”,将来在某个时候它会被当作垃圾收集。
  • 错题2
    What is the function of the dot operator?
    A . It serves to separate the integer portion from the fractional portion of a floating point number
    B . It allows one to access the data within an object when given a reference to the object
    C . It allows one to invoke a method within an object when given a reference to the object
    D . It is used to terminate commands (much as a period terminates a sentence in English)
    E . Both B and C are correct
    点运算符后面接要访问的数据或方法,答案为E。
  • 错题3
    An "alias" is when
    A . two different reference variables refer to the same physical object
    B . two different numeric variables refer to the same physical object
    C . two different numeric variables contain identical values
    D . two variables have the same names
    E . none of the above
    选A,当有两个或多个引用指向同一物理对象时,就会发生“别名”,以便通过引用两个引用,可以读取/写入/修改对象。
  • 错题4
    The advantage(s) of the Random class' pseudo-random number generators, compared to the Math.random method, is that
    A . you may create several random number generators
    B . the generators in Random are more efficient than the one in Math.random
    C . you can generate random ints, floats, and ints within a range
    D . you can initialize and reinitialize Random generators
    E . all but answer B
    所有随机数生成器的效率是相同的。随机发生器在Math.random的优点包括所有其他属性。选E。
  • 错题5
    These two ways of setting up a String yield identical results:
    a) String string = "12345"
    b) String string = 12345;
    A . true
    B . false
    选B,b句不能编译
  • 错题6
    These two ways of setting up a String yield identical results:
    a) String string = new String(12345);
    b) String string = new String("12345");
    A . true
    B . false
    选B,a句不能编译
  • 错题7
    You may use the String replace( ) method to remove characters from a String.
    A . true
    B . false
    选B,用replace方法字符串长度不会改变
  • 错题8
    The printf method within System.out is designed to ease the conversion of legacy C code into Java.
    A . true
    B . false
    prinff程序提供C编程语言中格式化输出的类似功能,使程序员更易将一个现有的C程序移植为Java程序,答案为A

其他(感悟、思考等,可选)

学习两章任务艰巨,不能像往常那样很轻松的完成任务,因此必须合理分配时间完成作业

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 128/128 1/1 12/12
第二周 212/340 1/2 18/30
第三周 206/546 1/3 20/50
第四周 483/1029 2/5 40/90

参考资料

posted @ 2018-04-04 23:48  m1sty  阅读(187)  评论(1编辑  收藏  举报