zoukankan      html  css  js  c++  java
  • 20182309 2019-2020-1 《数据结构与面向对象程序设计》第4周学习总结

    20182309 2019-2020-1 《数据结构与面向对象程序设计》第4周学习总结

    教材学习内容总结

    • 迭代器
    • 类的定义和实例化
    • get、set
    • return
    • 类的构造函数
    • 静态类和静态方法
    • 依赖、聚合
    • this
    • 方法重载
    • 调试

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

    • 问题1:如何比较布尔类型的数据
    • 问题1解决方案:调用方法equals,返回布尔值

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

    • 问题1:(int)Math.random只返回0
    • 问题1解决方案:最后再取整

    代码托管

    上周考试错题总结

    • 1.In order to preserve encapsulation of an object, we would do all of the following except for which one?

    A . Make the instance data private
    B . Define the methods in the class to access and manipulate the instance data
    C . Make the methods of the class public
    D . Make the class final
    E . All of the above preserve encapsulation
    D,封装意味着类包含操作数据所需的数据和方法。为了正确地保留封装,实例数据不应该直接从类外部访问,因此实例数据被设为私有,并定义方法来访问和操作实例数据。此外,访问和操作实例数据的方法被公开,以便其他类可以使用该对象。保留字“最终”用于控制继承,与封装无关。

    • 2.If a method does not have a return statement, then

    A . it will produce a syntax error when compiled
    B . it must be a void method
    C . it can not be called from outside the class that defined the method
    D . it must be defined to be a public method
    E . it must be an int, double, float or String method
    B,所有的方法都是隐含的,因此必须有一个return语句。但是,如果程序员希望编写一个不返回任何内容的方法,因此不需要返回语句,那么它必须是一个void方法(其头具有void作为其返回类型的方法)。

    • 3.Consider a sequence of method invocations as follows: main calls m1, m1 calls m2, m2 calls m3 and then m2 calls m4, m3 calls m5. If m4 has just terminated, what method will resume execution?

    A . m1
    B . m2
    C . m3
    D . m5
    E . main
    B,方法终止后,控件将继续使用调用该方法的方法。在这种情况下,m2调用m4,这样当m4终止时,m2将恢复

    • 4.Visibility modifiers include

    A . public, private
    B . public, private, protected
    C . public, private, protected, final
    D . public, protected, final, static
    E . public, private, protected, static
    B,public、private和protected控制变量和方法的可见性。final控制变量、方法或类是否可以进一步更改或重写为不可见。静态控制变量或方法是否与类的实例或类本身关联。

    • 5.What happens if you declare a class constructor to have a void return type?

    A . You'll likely receive a syntax error
    B . The program will compile with a warning, but you'll get a runtime error
    C . There's nothing wrong with declaring a constructor to be void
    D . The class' default constructor will be used instead of the one you're declaring
    E . None of the above
    A,声明任何类型的构造函数为偶数void都是违反语法的,这样会收到语法错误

    • 6.The following method header definition will result in a syntax error: public void aMethod( );

    A . true
    B . false
    A,语法错误的原因是它以“;”符号结尾。它后面需要{},括号内有0条或更多指令。抽象方法将以“;”结尾,但此头不定义抽象方法。

    结对及互评

    • 博客中值得学习的或问题:
      • 学习深刻,自己有方法
    • 代码中值得学习的或问题:
      • 使用继承减少代码的重复编写
    • 基于评分标准,我给本博客打分:10分。得分情况如下:
      • 正确使用Markdown语法(加1分)
      • 模板中的要素齐全(加1分)
      • 教材学习中的问题和解决过程, 一个问题加1分
      • 代码调试中的问题和解决过程, 一个问题加1分
      • 本周有效代码超过300分行的(加2分)
      • 排版精美的加一分
      • 代码Commit Message规范的加1分
      • 有动手写新代码的加1分
      • 结对学习情况真实可信的加1分

    点评过的同学博客和代码

    • 本周结对学习情况
      • 20182331
      • 结对学习内容
        • 学习IDEA的操作
        • 快捷生成类
        • 集成开发
        • 使用IDEA快速处理错误

    学习进度条

    代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
    目标 10000行 30篇 400小时
    第一周 138/138 2/2 25/25 学会写和上传代码,会编简单的输出程序
    第二周 88/226 1/3 30/55 起文件名不能太长
    第三周 898/1124 2/5 35/90 Java类里面的方法和C语言的函数很像
    第四周 632/1756 2/7 30/120 可以用继承extends简化重复的代码

    参考资料

  • 相关阅读:
    哈密顿绕行世界问题 (dfs)
    山东省第八届ACM大学生程序设计竞赛
    HDU
    HDU
    hdu 1241(DFS/BFS)
    centos7 df 命令卡死
    hosts文件修改之后立刻刷新
    shell脚本打印日期时间
    CentOS6设置php-fpm开机自启动
    Word中怎么设置忽略拼写和语法检查提醒
  • 原文地址:https://www.cnblogs.com/blueflameashe/p/11612581.html
Copyright © 2011-2022 走看看