• 20155314 2016-2017-2 《Java程序设计》第8周学习总结


    20155314 2016-2017-2 《Java程序设计》第8周学习总结

    教材学习内容总结

    • 了解NIO
    • 会使用Channel、Buffer与NIO2
    • 会使用日志API、国际化
    • 会使用正则表达式
    • 了解JDK8增强功能

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

    课后习题

    所谓“实践是检验认识真理性的唯一标准”,我在IntelliJ IDEA上把教材第三章课后练习题又敲了一
    遍,给出了自己的答案,并加上了一些自己的分析,通过逐题进行代码调试实践的方式来深入对java类与对象的理解。小白在此恳请大家积极指出错误的地方(>_<)

    9.4.1 选择题

    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) {
       
               }
           }
       }
      



    2. 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) {
       
               }
           }
       }
      




    3. 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());
               }
           } 
       }
      



    4. 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);
           }
           }
       }
      

    5. 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());
           }
       }
      

    6. 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);
               } 
           }
       }
      

    7. ABC

    8. 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);
               }
           }
       }
      

    9. 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);
               }
           }
       }
      




    10. 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 选择题

    1. AC

    2. BD

    3. AC

    4. BD
      分析:

    5. 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());
           }
       }
      

    6. 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);
               } 
           }
       }
      


    7. BC

    8. BD

    9. D
      错选:B

    10. ABD
      错选:AD
      分析:

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

    • 帮助20155324王鸣宇同学解决了Linux命令行下git commit和git push的问题~为此鸣宇还专门写了一篇博客记录下我们探索的详细过程~总之挺有成就感的嘻嘻( ̀⌄ ́)

      如何解决无法成功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.

    结对及互评

    评分标准

    1. 正确使用Markdown语法(加1分):

      • 不使用Markdown不加分
      • 有语法错误的不加分(链接打不开,表格不对,列表不正确...)
      • 排版混乱的不加分
    2. 模板中的要素齐全(加1分)

      • 缺少“教材学习中的问题和解决过程”的不加分
      • 缺少“代码调试中的问题和解决过程”的不加分
      • 代码托管不能打开的不加分
      • 缺少“结对及互评”的不能打开的不加分
      • 缺少“上周考试错题总结”的不能加分
      • 缺少“进度条”的不能加分
      • 缺少“参考资料”的不能加分
    3. 教材学习中的问题和解决过程, 一个问题加1分

    4. 代码调试中的问题和解决过程, 一个问题加1分

    5. 本周有效代码超过300分行的(加2分)

      • 一周提交次数少于20次的不加分
    6. 其他加分:

      • 周五前发博客的加1分
      • 感想,体会不假大空的加1分
      • 排版精美的加一分
      • 进度条中记录学习时间与改进情况的加1分
      • 有动手写新代码的加1分
      • 课后选择题有验证的加1分
      • 代码Commit Message规范的加1分
      • 错题学习深入的加1分
      • 点评认真,能指出博客和代码中的问题的加1分
      • 结对学习情况真实可信的加1分
    7. 扣分:

      • 有抄袭的扣至0分
      • 代码作弊的扣至0分
      • 迟交作业的扣至0分

    点评模板:

    • 博客中值得学习的或问题:

      • xxx
      • xxx
      • ...
    • 代码中值得学习的或问题:

      • xxx
      • xxx
      • ...
    • 基于评分标准,我给本博客打分:XX分。得分情况如下:xxx

    • 参考示例

    点评过的同学博客和代码

    感悟

    学期过半,北京也开始由春转夏、渐渐炎热了。这周终于算是将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小时

    参考资料

  • 相关阅读:
    UML序列图
    接口初探
    Discuz初探
    Vim指令学习
    UCenter Home代码研读之space.php
    建站须知
    linux指令之文件的创建、查询、修改
    InitPHP初探
    php环境搭建
    Zend Framework学习之Zend_Db 数据库操作
  • 原文地址:https://www.cnblogs.com/crazymosquito/p/6711316.html
Copyright © 2020-2023  润新知