20172333 2017-2018-2 《Java程序设计》第4周学习总结
20172333 2017-2018-2 《Java程序设计》第4周学习总结
教材学习内容
1.类结构的定义与概念
2.利用实例数据建立对象状态的概念
3.描述可见性修饰符作用在方法和数据上的效果
4.学习方法参数与返回值的运用
5.构造方法的结构和用途
6.学习了面向对象软件设计的主要步骤
7.程序所需的类和对象的技术
8.类之间的三种关系
9.Static在方法的作用效果
10.静态变量,静态方法,非静态方法,非静态变量的差别
11.this应用语句
12.接口
13.枚举类型
代码调试中的问题和解决过程
[x] 问题1:刚开始做的使用Die的方法的Java程序,未提前声明类,导致一直报错。

解决过程: 在重复改正无效后,参考书上后尝试将后面的Die.java程序编译运行后,再度运行RollingDice.java,最终成功。


[x] 问题2:在进行PP4.9的程序编译时,题目要求使用之前的Die类文件并重新定义新的类,发生如图错误。

解决过程:我试图在书上寻找相关资料看是否可以解决该问题,但是并没有发现有明确的方法,我开始从头开始寻找错误,我突然想到在使用Die的话,就需要Die.class文件在该目录下,于是重新编译了一遍Die.class,结果问题还是没有解决,后来想起在RoolingDice.java中引用Die.java时要实例化,就在PairOfDice.Java中实例化了两个变量。错误就迎刃而解了。





教材学习中的问题和解决过程
- [x] 问题1:如何将对象作为参数进行传递?
- 解决过程:这道题我是在Sr7.21上看到的,我的理解是将对象里的实例数据赋值与某个参数,以这个参数进行传递。事实上答案解析却是将这个对象的引用副本复制给该方法,使该方法的实参和形参互相成为了对方的别名。
代码托管

(statistics.sh脚本的运行结果截图)
上周考试错题总结
1.The relationship between a class and an object is best described as
A . classes are instances of objects
B . objects are instances of classes
C . objects and classes are the same thing
D . classes are programs while objects are
variables
E . objects are the instance data of classes
总结:类中包含实例数据与方法,而对象就是实例化的数据。
- 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
总结:封装意味着该类包含了操纵数据所需的数据和方法。为了正确地保存封装,实例数据不应该直接从类之外访问,因此实例数据是私有的,并且定义了方法来访问和操纵实例数据。此外,访问和操纵实例数据的方法被公开,以便其他类可以使用该对象。
3.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
总结:只有void方法不用返回,其余的都有相应的返回值。
4.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
总结:一旦方法终止,方法里的值便会恢复。
5.Consider a Rational class designed to represent rational numbers as a pair of int's, along with methods reduce (to reduce the rational to simplest form), gcd (to find the greatest common divisor of two int's), as well as methods for addition, subtraction, multiplication, and division. Why should the reduce and gcd methods be declared to be private.
A . Because they will never be used
B . Because they will only be called from
methods inside of Rational
C . Because they will only be called from the constructor of Rational
D . Because they do not use any of Rational's instance data
E . Because it is a typo and they should be declared as public
总结:私有定义只能在本类之中使用。
- In black-box testing, the tester should already know something about how the program is implemented so that he/she can more carefully identify what portion(s) of the software are leading to errors.
A . true
B . false
总结:黑盒实验,程序员只是知道输入与输出,不知道其具体方法,一点知道方法便变成了透明盒实验了。
7.Interface classes cannot be extended but classes that implement interfaces can be extended.
A . true
B . false
总结:除了Final不可扩展,其余均可拓展。
8.Formal parameters are those that appear in the method call and actual parameters are those that appear in the method header.
A . true
B . false
总结:形参是方法头里面的,实参是方法内部的参数。
9.Assume that the class Bird has a static methodfly( ). If b is a Bird, then to invoke fly, you could do Bird.fly( );.
A . true
B . false
总结:静态方法所有都共享。
10.The goal of testing is to
A . ensure that the software has no errors
B . find syntax errors
C . find logical and run-time errors
D . evaluate how well the software meets the original requirements
E . give out-of-work programmers something to do
总结:测试Java程序是为了确保程序逻辑错误不出现。
学习进度条
| 代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
|---|---|---|---|---|
| 目标 | 5000行 | 30篇 | 400小时 | |
| 第一周 | 125/125 | 2/2 | 20/20 | |
| 第二周 | 269/394 | 2/4 | 未知/38 | |
| 第三周 | 477/920 | 1/5 | X/X | |
| 第四周 | 1179/2338 | 1/6 | -- |




20172333 2017-2018-2 《Java程序设计》第4周学习总结的更多相关文章
- 学号 20175212 《Java程序设计》第九周学习总结
学号 20175212 <Java程序设计>第九周学习总结 教材学习内容总结 一.MySQL数据库管理系统 1.在官网上下载并安装MySQL 2.在IDEA中输入测试代码Connectio ...
- 20145213《Java程序设计》第九周学习总结
20145213<Java程序设计>第九周学习总结 教材学习总结 "五一"假期过得太快,就像龙卷风.没有一点点防备,就与Java博客撞个满怀.在这个普天同庆的节日里,根 ...
- 20145213《Java程序设计》第二周学习总结
20145213<Java程序设计>第二周学习总结 教材学习内容总结 本周娄老师给的任务是学习教材的第三章--基础语法.其实我觉得还蛮轻松的,因为在翻开厚重的书本,一股熟悉的气息扑面而来, ...
- 20145213《Java程序设计》第一周学习总结
20145213<Java程序设计>第一周学习总结 教材学习内容总结 期待了一个寒假,终于见识到了神秘的娄老师和他的Java课.虽说算不上金风玉露一相逢,没有胜却人间无数也是情理之中,但娄 ...
- 21045308刘昊阳 《Java程序设计》第九周学习总结
21045308刘昊阳 <Java程序设计>第九周学习总结 教材学习内容总结 第16章 整合数据库 16.1 JDBC入门 16.1.1 JDBC简介 数据库本身是个独立运行的应用程序 撰 ...
- 20145330孙文馨 《Java程序设计》第一周学习总结
20145330孙文馨 <Java程序设计>第一周学习总结 教材学习内容总结 刚开始拿到这么厚一本书说没有压力是不可能的,开始从头看觉得很陌生进入不了状态,就稍微会有一点焦虑的感觉.于是就 ...
- 20145337 《Java程序设计》第九周学习总结
20145337 <Java程序设计>第九周学习总结 教材学习内容总结 数据库本身是个独立运行的应用程序 撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的增删查找 JDBC可以 ...
- 20145337 《Java程序设计》第二周学习总结
20145337 <Java程序设计>第二周学习总结 教材学习内容总结 Java可分基本类型与类类型: 基本类型分整数(short.int.long).字节(byte).浮点数(float ...
- 20145218《Java程序设计》第一周学习总结
20145218 <Java程序设计>第一周学习总结 教材学习内容总结 今天下午看了Java学习的视频,感觉很是新奇,之前觉得Java学起来是艰难枯燥的,但通过第一章的学习觉得如果自己可以 ...
- 《Java程序设计》第九周学习总结
20145224 <Java程序设计>第九周学习总结 第十六章 整合数据库 JDBC入门 ·数据库本身是个独立运行的应用程序 ·撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的 ...
随机推荐
- 【Git/GitHub学习笔记】基本操作——创建仓库,本地、远程同步等
近日想分享一些文件,但是用度盘又太麻烦了(速度也很恶心).所以突发奇想去研究了下GitHub的仓库,这篇文章也就是一个最最最基础的基本操作.基本实现了可以在GitHub上存储文本信息与代码. 由于我的 ...
- win10远程桌面配置
Win10连接远程桌面的时候提示您的凭证不工作该怎么办? http://www.cnblogs.com/zhuimengle/p/6048128.html 二.服务器端 1.依旧进入组策略,不过是在服 ...
- linux命令行todo列表管理工具Taskwarrior介绍
Taskwarrior 是一款在命令行下使用的TODO列表管理工具,或者说任务管理工具,灵活,快速,高效. 安装 在ubuntu 14.04 中,可从官方仓库安装task软件包 sudo apt-ge ...
- linux===给新手的 10 个有用 Linux 命令行技巧(转)
本文转自:http://www.codeceo.com/article/10-linux-useful-command.html?ref=myread 仅用作学习交流使用.如有侵权,立删 我记得我第一 ...
- C# 笔记——覆盖和重写
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...
- [ python ] 小脚本及demo-持续更新
1. 备份文件并进行 md5 验证 需求分析: 根据需求,这是一个流程化处理的事件. 检验拷贝文件是否存在,不存在则执行拷贝,拷贝完成再进行 md5 值的比对,这是典型的面向过程编程: 代码如下: ...
- js-callee,call,apply概念
JS - caller,callee,call,apply 概念[转载] 在提到上述的概念之前,首先想说说javascript中函数的隐含参数:arguments Arguments : 该对象代表正 ...
- 7:django 中间件
中间件 中间件是一个连接django请求/相应处理的框架,是一个轻量级的低层次的全局影响django输入输出的系统插件. 每一个中间件组件负责一些特定的功能,这里我们我们只看一下如何激活使用系统自带的 ...
- Visual Studio Code 相关设置
Visual Studio Code 编译 SASS 到 CSS : 1.安装node 环境 2.Ctrl + Shift + ~,打开终端窗口 cd 到 SASS 文件目录,node-sass Te ...
- 错误:Eclipse老是出现 updating error reports database
Eclipse 火星版(Mars)一直出现 updating error reports database. Window--->Preferences--->General---> ...