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

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

    教材学习内容总结

    第七周学习的主要内容是课本的第十二第十三章:

    • 第十二章主要内容:
    1. “Lambda 表达式”(lambda expression)是一个匿名函数,Lambda表达式基于数学中的λ演算得名,直接对应于其中的lambda抽象(lambda abstraction),是一个匿名函数,即没有函数名的函数。Lambda表达式可以表示闭包(注意和数学传统意义上的不同)。

    2. 函数式接口:Functional Interface.
      定义的一个接口,接口里面必须 有且只有一个抽象方法 ,这样的接口就成为函数式接口。在可以使用lambda表达式的地方,方法声明时必须包含一个函数式的接口。任何函数式接口都可以使用lambda表达式替换。

    3. Lambda 表达式基本语法:
      (parameters) -> expression 或 (parameters) ->{ statements; }
      即: 参数 -> 带返回值的表达式/无返回值的陈述优点是极大的简化代码,比匿名内部类更加高效(不确定)。但也有缺点:可读性差。

    • 第十三章的主要内容:
    1. Java中6个时间类:
      java.util.Date java.sql.Date java.sql.Time java.sql.Timestamp java.text.SimpleDateFormat java.util.Calendar

    2. java.util.Date、java.util.Calendar、java.sql.Timestamp具有的时间日期组件(而且他们具有无参构造方法),java.sql.Date和java.sql.Time只有时间或日期组件。

    3. Date 对象表示时间的默认顺序是星期、月、日、小时、分、秒、年。若需要修改时间显示的格式可以使用“SimpleDateFormat(String pattern)”方法。

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

    • 首先主要是和自己的结对对象讨论一些教材前几章的问题,回顾了一下类的继承,classpath的设置,构造函数等方面内容。

    • 在使用Lambda 表达式时,对于语法的记忆一直掌握不太牢固,通过敲网上的一些博客上的代码,练习了一下

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

    • 问题:找不到类
    • 解决:添加-cp bin/07,设置好class路径。

    代码托管

    上周考试错题总结

    1. 下面代码中共有()个线程?
    public class ThreadTest {
        public static void main(String args[]){
            MyThread myThread =new MyThread();
            Thread t1=new Thread(myThread);
            Thread t2=new Thread(myThread);
            t1.start();
            t2.start();
        }
    }
    class MyThread extends Thread {
        ...
    }
    

    A .1
    B .2
    C .3
    D .4
    正确答案: C
    我的答案: B
    分析:除了t1,t2, 还有main所在的主线程。

    1. 调用线程的interrupt()方法 ,会抛出()异常对象?
      A .IOException
      B .IllegalStateException
      C .RuntimeException
      D .InterruptedException
      E .SecurityException
      正确答案: D E
      我的答案: D
      分析:查看帮助文档

    2. Given an instance of a Stream, s, and a Collection, c, which are valid ways of creating a parallel stream? (Choose all that apply.)
      给定一个Stream的实例s, 一个Collection的实例c, 下面哪些选项可以创建一个并行流?

    A .new ParallelStream(s)
    B .c.parallel()
    C .s.parallelStream()
    D .c.parallelStream()
    E .new ParallelStream(c)
    F .s.parallel()
    正确答案: D F
    我的答案: B

    1. Which of the following statements about the Callable call() and Runnable run() methods are correct? (Choose all that apply.)
      A .Both can throw unchecked exceptions.
      B .Callable takes a generic method argument.
      C .Callable can throw a checked exception.
      D .Both can be implemented with lambda expressions.
      E .Runnable returns a generic type.
      F .Callable returns a generic type.
      G .Both methods return void
      正确答案: A C D F
      我的答案: C E

    2. What are some reasons to use a character stream, such as Reader/Writer, over a byte stream, such as InputStream/OutputStream? (Choose all that apply.)

    A .More convenient code syntax when working with String data
    B .Improved performance
    C .Automatic character encoding
    D .Built-in serialization and deserialization
    E .Character streams are high-level streams
    F .Multi-threading support
    正确答案: A C
    我的答案: F

    6.Assuming / is the root directory, which of the following are true statements? (Choose all that apply.)

    A ./home/parrot is an absolute path.
    B ./home/parrot is a directory.
    C ./home/parrot is a relative path.
    D .The path pointed to from a File object must exist.
    E .The parent of the path pointed to by a File object must exist.
    正确答案: A
    我的答案: E

    1. What is the result of executing the following code? (Choose all that apply.)
      String line;
      Console c = System.console();
      Writer w = c.writer();
      if ((line = c.readLine()) != null)
      w.append(line);
      w.flush();

    A .The code runs without error but prints nothing.
    B .The code prints what was entered by the user.
    C .An ArrayIndexOutOfBoundsException might be thrown.
    D .A NullPointerException might be thrown.
    E .An IOException might be thrown.
    F .The code does not compile.
    正确答案: B D E
    我的答案: C

    1. Which of the following are true? (Choose all that apply.)

    A .A new Console object is created every time System.console() is called.
    B .Console can only be used for reading input and not writing output.
    C .Console is obtained using the singleton pattern.
    D .When getting a Console object, it might be null.
    E .When getting a Console object, it will never be null.
    正确答案: C D
    我的答案: B D

    1. Which classes will allow the following to compile? (Choose all that apply.)
      InputStream is = new BufferedInputStream(new FileInputStream("zoo.txt"));
      InputStream wrapper = new _____(is);

    A .BufferedInputStream
    B .FileInputStream
    C .BufferedWriter
    D .ObjectInputStream
    E .ObjectOutputStream
    F .BufferedReader
    正确答案: A D
    我的答案: A B

    1. Suppose that the file c:ookjava exists. Which of the following lines of code creates an object that represents the file? (Choose all that apply.)

    A .new File("c:ookjava");
    B .new File("c:ookjava");
    C .new File("c:/book/java");
    D .new File("c://book//java");
    E .None of the above
    正确答案: B C
    我的答案: A

    结对及互评

    评分标准

    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分

    点评过的同学博客和代码

    学习进度条

    代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
    目标 5000行 15篇 400小时
    第一周 4/4 1/1 10/10
    第二周 20/24 1/2 9/19
    第三周 80/104 1/3 10/29
    第四周 343/ 447 1/4 15/44
    第五周 748/1195 1/5 20/64 能够自己敲出一些简单的程序
    第六周 207/1402 1/6 10/74 继续敲出一些简单的程序
    第七周 241/1643 2/8 11/85
    • 计划学习时间:20小时

    • 实际学习时间:11小时

    • 改进情况:无

    参考资料

  • 相关阅读:
    进程对象的属性或方法详解
    进程理论以及开启子进程的两种方式
    计算机发展史(多道技术)
    基于socketserver实现的并发(tcp和udp)
    基于udp协议的套接字及udp协议粘包问题
    模拟ssh的远程网络传输
    周考题目及答案
    c/s架构搭建
    网络编程基础
    10.16模拟赛(湖南集训)
  • 原文地址:https://www.cnblogs.com/blackay03/p/6686953.html
Copyright © 2011-2022 走看看