20155314 2016-2017-2 《Java程序设计》第8周学习总结
20155314 2016-2017-2 《Java程序设计》第8周学习总结
教材学习内容总结
- 了解NIO
- 会使用Channel、Buffer与NIO2
- 会使用日志API、国际化
- 会使用正则表达式
- 了解JDK8增强功能
教材学习中的问题和解决过程
课后习题
所谓“实践是检验认识真理性的唯一标准”,我在IntelliJ IDEA上把教材第三章课后练习题又敲了一
遍,给出了自己的答案,并加上了一些自己的分析,通过逐题进行代码调试实践的方式来深入对java类与对象的理解。小白在此恳请大家积极指出错误的地方(>_<)
9.4.1 选择题
CD 分析:
import java.util.*;
import java.util.ArrayList;
public class Exercise9411 {
public static void main(String[] args) {
foreach(new HashSet());
foreach(new ArrayList());
}
private static void foreach(Collection elements) {
for(Object o : elements) { }
}
}



AB 分析:
import java.util.*;
//import java.util.ArrayList; public class Exercise9412 {
public static void main(String[] args) {
foreach(new HashSet() {
});
}
private static void foreach(Iterable iterable) {
for(Object o : iterable) { }
}
}




C 分析:
import java.util.*;
public class Exercise9413 {
public static void main(String[] args) {
foreach(new HashSet());
}
private static void foreach(Collection collection) {
Iterator elements = collection.iterator();
while(elements.hasNext()) {
System.out.println(elements.next());
}
}
}



D 分析:
import java.util.*;
class Student9414 {
String number;
String name;
int score;
Student9414(String number, String name, int score) {
this.number = number;
this.name = name;
this.score = score;
}
}
public class Exercise9414 {
public static void main(String[] args) {
Set<Student9414> students = new TreeSet<>();
students.add(new Student9414("B1234", "Justin", 90));
students.add(new Student9414("B5678", "Monica", 100));
foreach(students);
}
private static void foreach(Collection<Student9414> students) {
for(Student9414 student : students) {
System.out.println(student.score);
}
}
}

D 分析:
import java.util.*;
class Student9415 {
String number;
String name;
int score;
Student9415(String number, String name, int score) {
this.number = number;
this.name = name;
this.score = score;
}
}
public class Exercise9415 {
public static void main(String[] args) {
Set<Student9415> students = new HashSet<>();
students.add(new Student9415("B1234", "Justin", 90));
students.add(new Student9415("B5678", "Monica", 100));
students.add(new Student9415("B1234", "Justin", 100));
students.add(new Student9415("B5678", "Monica", 98));
students.add(new Student9415("B5678", "Monica", 100));
System.out.println(students.size());
}
}

A 分析:
import java.util.*;
public class Exercise9416 {
public static void main(String[] args) {
Set<Integer> numbers = new TreeSet<>();
numbers.add(1);
numbers.add(2);
numbers.add(1);
numbers.add(3);
foreach(numbers);
}
private static void foreach(Collection<Integer> numbers) {
for(Integer number : numbers) {
System.out.println(number);
}
}
}

ABC
C
import java.util.*;
public class Exercise9418 {
public static void main(String[] args) {
Set numbers = new TreeSet();
numbers.add(1);
numbers.add(2);
numbers.add(1);
numbers.add(3);
for(Integer number : numbers) {
System.out.println(number);
}
}
}

C 分析:
import java.util.*;
public class Exercise9419 {
public static void main(String[] args) {
Set<Integer> numbers = new TreeSet<>();
numbers.add(1);
numbers.add(2);
numbers.add(1);
numbers.add(3);
for(Integer number : numbers) {
System.out.println(number);
}
}
}




CD
import java.util.*;
public class Exercise94110 {
public static void main(String[] args) {
Map<String, String> messages = new HashMap<>();
messages.put("Justin", "Hello");
messages.put("Monica", "HiHi");
foreach(messages.values());
}
private static void foreach(Iterable<String> values) {
for(String value : values) {
System.out.println(value);
}
}
}



10.4.1 选择题
AC
BD
AC
BD
分析:

A
分析:import java.util.*;
class Student9415 {
String number;
String name;
int score;
Student9415(String number, String name, int score) {
this.number = number;
this.name = name;
this.score = score;
}
}
public class Exercise9415 {
public static void main(String[] args) {
Set<Student9415> students = new HashSet<>();
students.add(new Student9415("B1234", "Justin", 90));
students.add(new Student9415("B5678", "Monica", 100));
students.add(new Student9415("B1234", "Justin", 100));
students.add(new Student9415("B5678", "Monica", 98));
students.add(new Student9415("B5678", "Monica", 100));
System.out.println(students.size());
}
}




BC 分析:
import java.util.*;
public class Exercise9416 {
public static void main(String[] args) {
Set<Integer> numbers = new TreeSet<>();
numbers.add(1);
numbers.add(2);
numbers.add(1);
numbers.add(3);
foreach(numbers);
}
private static void foreach(Collection<Integer> numbers) {
for(Integer number : numbers) {
System.out.println(number);
}
}
}


BC
BD
D
错选:BABD
错选:AD
分析:


代码调试中的问题和解决过程
帮助20155324王鸣宇同学解决了Linux命令行下git commit和git push的问题~为此鸣宇还专门写了一篇博客记录下我们探索的详细过程~总之挺有成就感的嘻嘻( ̀⌄ ́)
关于20155322秦诗茂同学macOS下Vim编码问题(已解决,改为UTF-8即可)

代码托管
(statistics.sh脚本的运行结果截图)


上周考试错题总结
本周第二次采用了在蓝墨云班课上考试的形式,在45分钟的时间里需要作答20道选择题,而且还有不少多选题,甚至大多都是程序分析题,一道一道敲到电脑上再去运行肯定是来不及的(>_<),更要命的是很多题不去跑程序的话我根本无从下手(>o<)所以还是老老实实学扎实才是万全之策啊~
下面哪些Linux 命令可以ASCII码和16进制单字节方法输出Hello.java的内容?
- A .od -b -tx1 Hello.java
- B .od -tcx1 Hello.java
- C .od -tc -tx1 Hello.java
- D .od -tbx1 Hello.java
正确答案: B C
我的答案: C
分析:-b 是以八进制输出
JDK8 中新时间API中,用于度量时间的类有()
- A .Instant
- B .Duration
- C .Period
- D .LocalDateTime
正确答案: B C
你的答案: A D
分析:p442
An object can be thought of as a blueprint for a set of classes(对象被认为是类集合的蓝图).
- A .true
- B .false
正确答案: B
我的答案: A
分析:A class can be thought of as a blueprint for a set of objects; not the other way around.
When an object is passed to a method, the actual and formal parameters become aliases(当把对象传递给方法时,实参和形参互为别名).
- A .true
- B .false
正确答案: A
我的答案: B
分析:Actual parameters are the datum that are sent into the method. The formal parameters are used in the method definition. When objects are sent to a method, both of these values are references, and they become aliases of one another.Which of the following objects could contain the information “eastern standard time”?(下面哪些类的对象会包含“东部标准时间”的信息)
(Choose all that apply.)- A .Instant
- B .LocalDate
- C .LocalDateTime
- D .LocalTime
- E .ZonedDateTime
正确答案: E
我的答案: A E
分析:LocalXXXX explicitly excludes time zones. Instant represents a point in time, but
always uses GMT rather than the desired time zone.Which of the following are stored in a Period object? (Choose all that apply.) 下面哪些内容会出现在Period对象中?
- A .Year
- B .Month
- C .Day
- D .Hour
- E .Minute
- F .Second
正确答案: A B C
我的答案: A B C D E F
分析:Remember that Duration uses hours/minutes/seconds and Period uses years/
months/days for measures.Given the following, which answers can correctly fill in the blank? (Choose all that apply.)针对下面的代码,()中应填入哪个选项?
LocalDate date = LocalDate.now();
LocalTime time = LocalTime.now();
LocalDateTime dateTime = LocalDateTime.now();
ZoneId zoneId = ZoneId.systemDefault();
ZonedDateTime zonedDateTime = ZonedDateTime.of(dateTime, zoneId);
long epochSeconds = 0;
Instant instant = ( );- A .Instant.now()
- B .Instant.ofEpochSecond(epochSeconds)
- C .date.toInstant()
- D .dateTime.toInstant()
- E .time.toInstant()
- F .zonedDateTime.toInstant()
正确答案: F
我的答案: A
分析:Option A correctly creates the current instant. Option B correctly converts from
seconds to an Instant. Option F is also a proper conversion. Options C, D, and E are
incorrect because the source object does not represent a point in time. Without a time zone,
Java doesn’t know what moment in time to use for the Instant.
结对及互评
评分标准
正确使用Markdown语法(加1分):
- 不使用Markdown不加分
- 有语法错误的不加分(链接打不开,表格不对,列表不正确...)
- 排版混乱的不加分
模板中的要素齐全(加1分)
- 缺少“教材学习中的问题和解决过程”的不加分
- 缺少“代码调试中的问题和解决过程”的不加分
- 代码托管不能打开的不加分
- 缺少“结对及互评”的不能打开的不加分
- 缺少“上周考试错题总结”的不能加分
- 缺少“进度条”的不能加分
- 缺少“参考资料”的不能加分
教材学习中的问题和解决过程, 一个问题加1分
代码调试中的问题和解决过程, 一个问题加1分
本周有效代码超过300分行的(加2分)
- 一周提交次数少于20次的不加分
其他加分:
- 周五前发博客的加1分
- 感想,体会不假大空的加1分
- 排版精美的加一分
- 进度条中记录学习时间与改进情况的加1分
- 有动手写新代码的加1分
- 课后选择题有验证的加1分
- 代码Commit Message规范的加1分
- 错题学习深入的加1分
- 点评认真,能指出博客和代码中的问题的加1分
- 结对学习情况真实可信的加1分
扣分:
- 有抄袭的扣至0分
- 代码作弊的扣至0分
- 迟交作业的扣至0分
点评模板:
博客中值得学习的或问题:
- xxx
- xxx
- ...
代码中值得学习的或问题:
- xxx
- xxx
- ...
基于评分标准,我给本博客打分:XX分。得分情况如下:xxx
点评过的同学博客和代码
本周结对学习情况
- 20155323
- 结对照片
- 结对学习内容
- 第六章 继承与多态
- 第三章 基础语法
上周博客互评情况
感悟
学期过半,北京也开始由春转夏、渐渐炎热了。这周终于算是将Java前9章学完了~前9章主要讲解的是Java核心和面向对象思想,后面从第10章开始都是关于使用Java各种类库的内容了,个人认为学起来相比之前基础部分应该要轻松许多,因此我计划加快自己的进度,毕竟距离老师的教学安排还落后好几章呢(>_<)
革命尚未成功,同志任需努力!
学习进度条
| 代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
|---|---|---|---|---|
| 目标 | 5000行 | 20篇 | 300小时 | |
| 第一周 | 34/34 | 1/4 | 12/12 | |
| 第二周 | 360/394 | 1/5 | 16/28 | |
| 第三周 | 701/1018 | 1/6 | 19/ 47 | 代码量激增( ̀⌄ ́) |
| 第四周 | 608/1375 | 1/7 | 18/55 | ①蹭了一节张健毅老师的Java课;②自己将数据结构课上所学的排序算法除了基数排序之外全部用C语言实现了一遍(`_´)ゞ;③本次博客史无前例的长:) |
| 第五周 | 1205/2580 | 1/8 | 9/64 | 蹭了一节张健毅老师的Java课 |
| 第六周 | 826/3339 | 1/9 | 8/72 | |
| 第七周 | 3119/6476 | 2/11 | 13/85 | ①蹭了一节张健毅老师的Java课;②在写了无数篇实验报告之后还写了两篇博客!! |
| 第八周 | / | 1/12 | 10/95 |
计划学习时间:12小时
实际学习时间:10小时
参考资料
20155314 2016-2017-2 《Java程序设计》第8周学习总结的更多相关文章
- 20155336 2016-2017-2《JAVA程序设计》第九周学习总结
20155336 2016-2017-2<JAVA程序设计>第九周学习总结 教材学习内容总结 第十六章 JDBC(Java DataBase Connectivity)即java数据库连接 ...
- 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入门 ·数据库本身是个独立运行的应用程序 ·撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的 ...
随机推荐
- MIT-6.828-JOS-lab3:User Environments
Lab 3: User Environments实验报告 tags:mit-6.828 os 概述: 本文是lab3的实验报告,主要介绍JOS中的进程,异常处理,系统调用.内容上分为三部分: 用户环境 ...
- 微软职位内部推荐-Senior Program Manager
微软近期Open的职位: Title: Senior Program Manager – Bing Multimedia Relevance Group: Search Technology Cent ...
- 转发npm发布包的过程
老板,来个npm账号! 因为你的包是要放在npm上的,所以,没有npm的账号,根本什么活都干不了. 在npm上注册一个账号是很简单的,随便填一下用户名密码邮箱,然后人家就会发个邮件给你,然后就注册成功 ...
- 组件 -- Button
.btn --------------------------------- button的背景色: .btn-primary .btn-success .btn-secondary .btn-dan ...
- PAT 甲级 1085 Perfect Sequence
https://pintia.cn/problem-sets/994805342720868352/problems/994805381845336064 Given a sequence of po ...
- IIS 下 搭建简单的FTP服务器
1. 修改用户策略, 创建简单用户密码 命令行输入 gpedit.msc 打开组策略 位置 2. 创建一个FTP使用的用户 net user zhaobsh Test6530 /add 3. 安装II ...
- java自定义注解学习(二)_注解详解
上篇文章,我们简单的实现了一个自定义注解,相信大家对自定义注解有了个简单的认识,这篇,这样介绍下注解中的元注解和内置注解 整体图示 内置注解 @Override 重写覆盖 这个注解大家应该经常用到,主 ...
- oracle11g的安装
1. 解压缩已经下载好的文件,两个文件一起解压,如图所示 2. 到解压路径当中找到setup.exe文件 3.安装的第一步,配置安全更新,如果不希望接收安全更新邮件可以选择将下方的复选框勾选去除 4. ...
- 利用powerful number求积性函数前缀和
好久没更博客了,先水一篇再说.其实这个做法应该算是杜教筛的一个拓展. powerful number的定义是每个质因子次数都 $\geq 2$ 的数.首先,$\leq n$ 的powerful num ...
- POJ 1062 昂贵的聘礼(图论,最短路径)
POJ 1062 昂贵的聘礼(图论,最短路径) Description 年轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用10000个金币作为聘礼才答应把女 ...