zoukankan      html  css  js  c++  java
  • 20172307 2017-2018-2 《程序设计与数据结构》第7周学习总结

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

    教材学习内容总结

    本周学习了有关继承的知识,包括以下几个知识点:
    1.Java中用“extends”来指明新类由现有类产生。示例:public class Dictionary extends Book
    2.protected修饰词。procted 的可见性介于pricate和public之间。
    3.super引用,子类通过super引用来调用父类的构造方法。
    4.多继承(在学习问题中总结)
    5.重写方法,子类可以重写父类方法。
    6.Object类。所有类都是从Object类中派生的。
    7.抽象类(在学习问题中总结)
    8.接口层次结构。基本和类的层次结构相似,不同的是接口不存在可见性问题,因为所有接口都是public。
    9.可见性。三种修饰词private,protected,public可见性从低到高。

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

    • 问题1:对教材中java如何通过接口实现多继承不太清楚。
    • 问题1解决方案:通过查阅网上的资料了解到子类继承一个父类,父类通过实现多个接口使得子类达到多继承的效果。
      参考至: ( java怎么实现多继承的功效
    • 问题2:对抽象类具体是什么东西怎么使用不太理解。
    • 问题2解决方案:通过网上的查阅明白了抽象类的定义简单来说就是含有abstract类作为修饰词的方法的类为修饰类。并且了解到它与普通类的不同和
      与接口的不同。与接口的不同中我认为最重要的不同在于抽象类是一种模版式设计,当有一个方法需要修改时只要修改一下父类就行,而接口时辐射式设计,当要改变一个方法时所有通过接口的地方
      都要进行修改。
      参考至: ( 深入理解Java的接口和抽象类

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

    在代码调试中没有出现太大的问题,主要的问题还是在构想程序上
    1.在pp9.1中我对返回硬币面值,还要相加有疑惑,我认为硬币只有一个面值,就钻进了死胡同。在参考了其他同学的想法后,明白了硬币的面值可以自己赋值。
    2.pp9.3主要是先创建一个父类,其他子类继承父类的方法同时添加自己的方法

    代码托管

    上周考试错题总结

    • 问题1:
      If an int array is passed as a parameter to a method, which of the following would adequately define the parameter list for the method header?
      A . (int[ ])
      B . (int a[ ])
      C . (int[ ] a)
      D . (int a)
      E . (a[ ])
      正确:C 错误:C
    • 问题1解析:
      错误的原因主要是因为没理解题意吧有几个单词的意思不太懂。这题其实就是数组的声明。
    • 问题2:
      If x is a char, and values is an int array, then values[x]
      A . causes a syntax error
      B . causes an Exception to be thrown
      C . casts x as an int based on x's position in the alphabet (for instance, if x is 'a' then it uses 0 and if x is 'z' then it uses 25)
      D . casts x as an int based on x's ASCII value (for instance, if x is 'a' then it uses 97 and if x is 'z' then it uses 122)
      E . casts x as an int based on the digit that is stored in x (for instance, if x is '3' it uses 3) but throws an exception if x does not store a digit
      正确:D 错误:A
    • 问题2解析:
      当x是一个字符,数组values[x],x在里面的值相当于x的ASCII码的值。
    • 问题3:
      Given the following declarations, which of the following variables are arrays?
      int[ ] a, b;
      int c, d[ ];
      A . a
      B . a and b
      C . a and d
      D . a, b and d
      E . a, b, c and d
      正确:D 错误:C
    • 问题:3解析:
      第一句a,b是数组,第二句,c是整数,d是数组。
    • 问题4:
      To initialize a String array names to store the three Strings "Huey", "Duey" and "Louie", you would do
      A . String names = {"Huey", ":Duey", "Louie"};
      B . String[ ] names = {"Huey", "Duey", "Louie"};
      C . String[ ] names = new String{"Huey", "Duey", "Louie"};
      D . String names[3] = {"Huey", "Duey", "Louie"};
      E . String names; names[0] = "Huey"; names[1] = "Duey"; names[2] = "Louie";
      正确:B 错误:C
    • 问题4解析:
      C不该加上保留字。
    • 问题5:
      An array, when instantiated, is fixed in size, but an ArrayList can dynamically change in size when new elements are added to it.
      A . true
      B . false
      正确:A 错误:B
    • 问题5解析:
      数组的大小是固定的。可以通过增加新元素来动态的改变其大小。

    结对及互评

    • 本周结对学习情况

      • 20172311
      • 本周还没有结队学习内容,下周开始吧。
    • 上周博客互评情况

    其他

    这周的学习相较于上一周要好一些,但与优秀的同学还是有差距,需要继续努力。

    学习进度条

    代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
    目标 5000行 30篇 400小时
    第一周 200/200 2/2 20/20
    第二周 300/500 1/3 18/38
    第三周 500/1000 1/4 22/60
    第四周 300/1300 1/5 30/90
    第五周 700/ 2000 1/6 30/120
    第六周 792/2792 1/7 30/150
    第七周 823/3559 1/8 30/180

    参考资料

    java怎么实现多继承的功效
    深入理解Java的接口和抽象类

  • 相关阅读:
    内部排序一
    安全的文件访问方式
    Json序列化
    对进度条的通用封装实现
    关于'//'解答
    jquery中美元符号($)命名冲突
    linux 文件属性与权限
    【层次查询】Hierarchical Queries之亲兄弟间的排序(ORDER SIBLINGS BY)
    How to create a freehand tool
    C# 获取COM对象 ProgId ClsId
  • 原文地址:https://www.cnblogs.com/20172307hyt/p/8908779.html
Copyright © 2011-2022 走看看