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时发生以下异常
    1333139-20180514003958991-441867946.png

  • 问题1解决方案:查询百度后发现是是输入的长度过长导致的
  • 问题2:测试运行失败
    1333139-20180514010106642-1317136015.png

  • 问题2解决方案:检查后发现缺少一个else语句
    1333139-20180514010014504-2089557139.png

代码托管

1333139-20180513210638292-1796836193.png
第一次使用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分。

点评过的同学博客和代码

  • 本周结对学习情况

学习进度条

代码行数(新增/累积)博客量(新增/累积)学习时间(新增/累积)重要成长
目标5000行30篇400小时
第一周200/2002/220/20
第二周287/4812/418/38
第三周320/8013/722/60
第四周900/16002/930/90
第五周807/24072/1140/130
第六周619/30232/1340/170
第七周621/36442/1540/210
第八周805/43642/1740/250
第九周1787/62112/1940/290

参考资料

转载于:https://www.cnblogs.com/huzhitao/p/9033291.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值