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入门 ·数据库本身是个独立运行的应用程序 ·撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的 ...
随机推荐
- Eureka服务下线(Cancel)源码分析
Cancel(服务下线) 在Service Provider服务shut down的时候,需要及时通知Eureka Server把自己剔除,从而避免其它客户端调用已经下线的服务,导致服务不可用. co ...
- deepin 快捷键
从此脱离鼠标
- 《LINUX3.0内核源代码分析》第二章:中断和异常 【转】
转自:http://blog.chinaunix.net/uid-25845340-id-2982887.html 摘要:第二章主要讲述linux如何处理ARM cortex A9多核处理器的中断.异 ...
- mysql连接池优化笔记
中间件mycat是一个高性能的分表分库读写分离的中间件,但配置不好的情况会出现很多性能问题. 1.mycat-web的监控的准确性有问题,1.6-RELEASE ,1.0-SNAPSHOT (web ...
- 【LabVIEW技巧】LabVIEW中的错误1
前言 前几日,小黑充电学习意外的看到了下面的这个东东. 编程许久竟然没有见过这样子的错误枚举,甚为好奇,问刘大后才知道是Error Ring,为此恶补一下LabVIEW中与错误处理相关的内容. 错误的 ...
- JS中类型检测方式
在js中的类型检测目前我所知道的是三种方式,分别有它们的应用场景: 1.typeof:主要用于检测基本类型. typeof undefined;//=> undefined typeof 'a' ...
- 理解rest架构
越来越多的人开始意识到,网站即软件,而且是一种新型的软件. 这种"互联网软件"采用客户端/服务器模式,建立在分布式体系上,通过互联网通信,具有高延时(high latency).高 ...
- java常用设计模式学习心得
学习自:http://shenzhenchufa.blog.51cto.com/730213/161581 代码来自:http://shenzhenchufa.blog.51cto.com/73021 ...
- [PAT] 1147 Heaps(30 分)
1147 Heaps(30 分) In computer science, a heap is a specialized tree-based data structure that satisfi ...
- 利用WINDOWS活动目录提供LDAP的方案
Windows Server 2008 R2 活动目录服务安装 http://blog.sina.com.cn/s/blog_622de9390100kgv3.html WINDOWS 2008 域控 ...