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

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

教材学习内容总结

  • 异常是定义一个非正常情况或错误的对象,由程序或运行时环境抛出。
  • 异常与错误不同,错误代表不可恢复的问题并且必须捕获处理
  • 堆栈踪迹指明异常何处发生
  • try语句后可跟多个catch子句,每个子句处理一种try语句抛出的异常
  • finally语句在try语句块之后,且必须执行
  • 许多异常类由Exception类派生
  • Java唯一不可检测异常是RuntimeException类或其子类
  • 标准I/O流有标准输出流,标准输入流,标准错误流(输出错误信息)
  • 递归是一种方法能够调用自己以达目的的编程技术,掌握递归编程的关键是能以递归的思想考虑问题
  • 只有递归定义的那一部分,递归将永无终止。
  • 方法调用自己的递归,称为直接递归;如果一个方法调用其他方法,最终导致再次调用自己,则称为间接递归。
  • 迷宫问题和汉诺塔问题

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

  • 问题1:关于不可检测异常RuntimeException类为什么不用显示声明

  • 问题1解决方案:查询资料知道RuntimeException的特点是非受检异常,也就是Java系统中允许可以不被catch,在运行时抛出。而其它定非运行时异常如果抛出的话必须显示的catch,否则编译不过。参考资料

  • 问题2:关于标准错误流不太理解

  • 问题2解决方案:查询资料后知道标准错误流用于输出错误信息参考资料

  • 问题3:对书上列子中的code.substring方法不太了解

  • 解决:翻阅教材后了解String subString(int offset,int endindex)返回字符串中从索引offset开始,到endIndex-1处的字串。

  • 问题4:对于书上的迷宫问题不太理解

  • 问题5:对于书上的汉诺塔问题不太理解
  • 解决:自己百度又找了几个例子才看懂。列1列2

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

  • 问题1:当测试pp12.1时发生以下异常

  • 问题1解决方案:查询百度后发现是是输入的长度过长导致的

  • 问题2:测试运行失败

  • 问题2解决方案:检查后发现缺少一个else语句

代码托管


第一次使用idea统计代码~

(statistics.sh脚本的运行结果截图)

上周考试错题总结

  • 错题1及原因,理解情况
    Polymorphism is achieved by
    A . overloading
    B . overriding
    C . embedding
    D . abstraction
    E . encapsulation
    正确答案: B 你的答案: A
    overloading仅为具有不同参数列表的方法提供了替代方法。 overriding提供了多态性,因为根据当前被引用的对象调用适当的方法。 embedding是类内的类的封闭。 abstraction与多态性无关。

  • 错题2及原因,理解情况
    Comparing the amount of memory required by selection sort and insertion sort, what can one say?
    A . Selection sort requires more additional memory than insertion sort
    B . Insertion sort requires more additional memory than selection sort
    C . Both methods require about as much additional memory as the data they are sorting
    D . Neither method requires additional memory
    E . None of the above
    正确答案: D
    你的答案: C
    不需要额外的存储空间,只要排序过程中被排序的数据只是重新排列在数据数组中。

  • 错题3及原因,理解情况
    Which statement is completely true?
    A . Java upcasts automatically, but you must explicitly downcast
    B . Java downcasts automatically, but you must explicitly upcast
    C . Java expects the user to explicitly upcast and downcast
    D . Java will both upcast and downcast automatically
    E . The rules for upcasting and downcasting depend upon whether classes are declared public, protected, or private
    正确答案: A
    你的答案: C
    upcasts是完全安全的,它是Java支持的单一继承结构的产物,但downcasts必须由程序员明确地完成。

  • 错题4及原因,理解情况
    Which of the following statements is completely true?
    A . If a class is declared to be abstract then every method in the class is abstract and must be overridden
    B . If a class is declared to be abstract then some methods in the class may have their bodies omitted
    C . If a class is declared to be abstract then all methods in the class must have their bodies omitted
    D . If a class is declared to be abstract then all the instance variables must be overridden when a concrete class is derived from the abstract base class
    正确答案: B
    你的答案: D
    创建抽象类的唯一方法是在类中创建一些抽象方法。 所以答案B是对的。

  • 错题5及原因,理解情况
    Can a program exhibit polymorphism if it only implements early binding?
    A . Yes, because one form of polymorphism is overloading
    B . No, because without late binding polymorphism cannot be supported
    C . Yes, because so long as the programs uses inheritance and/or interfaces it supports polymorphism
    D . Yes, because early binding has nothing to do with polymorphism
    E . none of the above
    正确答案: A
    你的答案: B
    虽然继承和接口支持多态,但只有在具有后期绑定时才会这样做。

结对及互评

点评模板:

  • 博客中值得学习的或问题:
    • 教材内容总结非常到位
    • 问题记录有点少
    • 这周的代码量不错
  • 代码中值得学习的或问题:
    • 代码很简洁,定义的方法也简单明了
    • 代码中注释较少
  • 基于评分标准,我给本博客打分:11分。

点评过的同学博客和代码

  • 本周结对学习情况
    • 20172318

    • 结对学习内容

      • 11章
      • 12章

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 200/200 2/2 20/20
第二周 287/481 2/4 18/38
第三周 320/801 3/7 22/60
第四周 900/1600 2/9 30/90
第五周 807/2407 2/11 40/130
第六周 619/3023 2/13 40/170
第七周 621/3644 2/15 40/210
第八周 805/4364 2/17 40/250
第九周 1787/6211 2/19 40/290

参考资料

posted @ 2018-05-13 21:08  大雪将烬  阅读(172)  评论(1编辑  收藏  举报