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入门 ·数据库本身是个独立运行的应用程序 ·撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的 ...
随机推荐
- 关于InfiniBand几个基本知识点解释
文章出处: https://blog.csdn.net/BtB5e6Nsu1g511Eg5XEg/article/details/83629279 公众号 https://blog.csdn.net/ ...
- ctf入门常见类别
原视频在这里:实验吧-名师指导http://www.shiyanbar.com/course-video/watch-video/cid/419/vid/2000网络安全从业者尝试介绍 web应用渗透 ...
- 微软职位内部推荐-Sr. SW Engineer for Privacy Id
微软近期Open的职位: Job posting title: Senior Software Engineer for Privacy Identification Profession: Engi ...
- PAT甲题题解-1055. The World's Richest (25)-终于遇见一个排序的不水题
题目简单,但解题的思路需要转换一下,按常规思路肯定超时,推荐~ 题意:给出n个人的姓名.年龄和拥有的钱,然后进行k次查询,输出年龄在[amin,amx]内的前m个最富有的人的信息.如果财富值相同就就先 ...
- linux第三章学习笔记
第三章 进程管理 进程是Unix操作系统抽象概念中最基本的一种. 进程管理是所有操作系统的心脏所在. 一.进程 1. 进程是处于执行期的程序.除了可执行程序代码,还包括打开的文件.挂起的信号.内核内部 ...
- OpenFlow 1.3 控制器与交换机的交互,以及拓扑发现
前言 最近纠结于控制器如何发现拓扑,于是就翻起了OpenFlow 1.3进行查看,以及一些相关协议 OF 1.3 安全通道,即交互消息 OpenFlow Switch Specification 1. ...
- php redis 的基本操作
前言: 断断续续的接触了redis的使用.但是也就简单的记住了几个set.get方法,用的还是太少了吧.所以来做个笔记,记录下一些常用的命令. 内容: 首先是php连接redis. $redis = ...
- Ubutnu linux 下升级python版本,以2.x升级到3.x为例
Linux操作系统一般 都会自带python,但是python版本会比主流低,故升级python, 主要思路:自带的python的链接link文件是在/usr/bin 下,采用sudo apt-get ...
- 深入理解es6的promise
一.promise入门 1. Promise对象是什么 回调函数的另一种原生实现,比之前回调函数的写法机构清晰,功能强大, 2.以前回调这么写 function a(fn){ let h = 1; s ...
- mininet invalid literal for int() with base 10: 'cpu.cfs_period_us:'
问题产生原因:内核编译时没有加入 CONFIG_CFS_BANDWIDTH 选项 http://www.haifux.org/lectures/299/netLec7.pdf https://mail ...