zoukankan      html  css  js  c++  java
  • 20155316 2016-2017-2 《Java程序设计》第7周学习总结

    教材学习内容总结

    1. 时间与日期

    1.1 时间的度量

    • GMT -> UT -> TAI -> UTC
    英文 缩写
    Greenwich Mean Time GMT
    Universal Time UT
    International Atomic Time TAI
    Coordinated Universal Time UTC
    • Unix时间以1970年1月1日00:00:00为起算点

    1.2 年历标准

    • ISO 8601标准

    时间日期表示方法标准,用以统一时间日期的数据交换格式

    1.3 时区

    • UTC偏移、日光节约时间(夏季时间)

    2. Date与Calendar

    1.1.1 Date

    • 用途:用来当作时间轴上的某一瞬间
    • 构建方法:Date()、Date(long date)
    • 方法:getTime()、setTime()

    1.1.2 DateFormat

    java.text.DateFormat(抽象类)

    其操作类为java.text.SimpleDateFormat parse()

    其含静态方法:getDateInstance()、getTimeInstance()、getDateTimeInstance()

    3. JDK8新时间日期API

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

    • 1.抽象类可以创建对象吗?
    • 可以在创建标签的时候使用,例如教材P432的第一个程序中就用到了抽象类DateFormat(DateFormat dateFormat = new SimpleDateFormat(args.length == 0 ? "EE-MM-dd-yyyy" : args[0]);
    • 2.java.text.DateFormat与java.text.NumberFormat究竟有什么不同呢?
    • 两者使用上类似,前者是对日期时间的格式化,后者是对数字进行格式化。
    • 3.Date、DateFormat、Calendar三者各自有什么区别?用法是什么?
    • Date:时间轴上的瞬时
    • DateFormat:格式化时间日期
    • Calendar: 对时间日期进行相关操作

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

    • 1.创建Date实例时使用构建date()和date(long date)时得出的结果是一样的,这是为什么呢?
    • 查了一下API文件,上面对于这两个的构建方法的解释是
    • 都是“Allocates a Data Object”,所不同的是后者是从long date标准基准时间(1970 年 1 月 1 日 00:00:00 GMT)来指定。前者没有参数传入,而后者有参数传入。

    代码托管

    (因为中途换电脑的原因,部分代码无法识别)

    上周考试错题总结

    • 1.下面哪条命令可以把 f1.txt 复制为 f2.txt ?
    • A. cp f1.txt f2.txt
    • B. copy f1.txt f2.txt
    • C. cat f1.txt > f2.tx
    • D. cp f1.txt | f2.tx
    • E. copy f1.txt | f2.tx
    • 正确答案: A C 你的答案: A B
    • [解析]copy是Windows下的命令。cat f1.txt > f2.tx 通过输出重定向实现了复制。
    • 2.Which of the following are built-in streams in Java? (Choose all that apply.)
    • A. System.err
    • B. System.error
    • C. System.in
    • D. System.input
    • E. System.out
    • F. System.output
    • 正确答案: A C E 你的答案: B C E
    • [解析]The System class has three streams: in is for input, err is for error, and out is for output. Therefore A, C, and E are correct. The others do not exist.
    • 4.Assuming zoo-data.txt is a multiline text file, what is true of the following method?
    private void echo() throws IOException {
        try (FileReader fileReader = new FileReader("zoo-data.txt");
        BufferedReader bufferedReader = new BufferedReader(fileReader)) {
                System.out.println(bufferedReader.readLine());
        }
    }
    
    • A. It prints the first line of the file to the console.
    • B. It prints the entire contents of the file.
    • C. The code does not compile because the reader is not closed.
    • D. The code does compile, but the reader is not closed.
    • E. The code does not compile for another reason.
    • 正确答案: A 你的答案: D
    • [解析]This code compiles and runs without issue, so C and E are incorrect. It uses a try-with- resource block to open the FileReader and BufferedReader objects. Therefore, both get closed automatically, and D is incorrect. The body of the try block reads in the first line of the file and outputs it to the user. Therefore, A is correct. Since the rest of the file is not read, B is incorrect.
    • 4.如果有以下代码段:
    Thread thread = new Thread(new ________________() {
        public void run() {...}
    });
    
    • 空白部分指定哪些类型可以通过编译?
    • A. Runnable
    • B. Thread
    • C. Future
    • D. Executor

    结对及互评

    点评过的同学博客和代码

    学习进度条

    代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
    目标 5000行 30篇 400小时
    第一周 45/45 1/1 15/15
    第二周 288/333 2/3 21/31
    第三周 513/846 1/4 11/42
    第四周 531/1377 1/5 12/54
    第五周 821/2198 1/6 15/69
    第六周 609/2807 1/7 10/79
    第七周 1/8 10/89
    • 计划学习时间:10小时

    • 实际学习时间:10小时

    • 改进情况:

    (有空多看看现代软件工程 课件
    软件工程师能力自我评价表
    )

    参考资料

  • 相关阅读:
    梅特卡夫法则(Metcalfe's law)
    jffs2reset 实现分析
    uhttpd配置文件分析
    疑问????
    ubuntu 修改root密码
    原始套接字
    位操作
    linux命令readlink
    awk 中 FS的用法
    Python做简单爬虫(urllib.request怎么抓取https以及伪装浏览器访问的方法)
  • 原文地址:https://www.cnblogs.com/protectmonarch/p/6686892.html
Copyright © 2011-2022 走看看