3、接口实现多态:接口名可用来声明引用变量。调用接口变量时只能调用接口中定义的方法,因为编译器只能判定对象是接口类的,子类自定义的方法无法响应。
5、I/O异常(其中还有老师上课讲的把数据写入文本,和从文本中读取数据内容)
三种标准I/O流(in、out、err)
可检测的IOExceptions异常
问题一解决方法:这个问题出现是因为我理解题目出现了问题,检测到输入得单词为“DONE”就停止,然后判断总输入字符串是否超过长度20个,如果是,就抛出异常。无异常的话可以再次输入。
问题二解决方法:刚听完IO的问题要尝试去编写IO的代码,对应的writer和reader什么的不了解,不过可以参考参考学长学姐的代码。代码中有BufferedOutputStream和BufferedInputStream两种可供理解,两种字节流可以使用,进行往文件里面写入读出。
问题三解决办法:最后找到string.split方法,以某一特殊符为界,分割字符串后将每一部分存入数组。
(statistics.sh脚本的运行结果截图)
错题1:A Java program can handle an exception in several different ways. Which of the following is not a way that a Java program could handle an exception?
A . ignore the exception
B . handle the exception where it arose using try and catch statements
C . propagate the exception to another method where it can be handled
D . throw the exception to a pre-defined Exception class to be handled
E . all of the above are ways that a Java program could handle an exception
错误:D 正确:E
解析:java处理异常的三种方式:1.根本不处理异常。2.当异常发生时处理异常。3.在程序的某个位置集中处理异常。
错题2:An exception can produce a "call stack trace" which lists:
A . the active methods in the order that they were invoked
B . the active methods in the opposite order that they were invoked
C . the values of all instance data of the object where the exception was raised
D . the values of all instance data of the object where the exception was raised and all local variables and parameters of the method where the exception was raised
E . the name of the exception thrown
错误:D 正确:B
解析:调用
错题3:An exception that could also arise in the try statement that does not have an associated catch statement is:
A . ClassNotFoundException
B . IllegalArgumentException
C . NegativeArraySizeException
D . NullPointException
E . OutOfMemoryException
错误:A 正确:D
解析:try语句后没有catch语句会出现NullPointException
错题4:We compare sorting algorithms by examining
A the number of instructions executed by the sorting algorithm
B the number of instructions in the algorithm itself (its length)
C the types of loops used in the sorting algorithm
D the amount of memory space required by the algorithm
E whether the resulting array is completely sorted or only partially sorted
分析:这道题考到的知识点为:不同的排序算法在执行时需要不同数量的指令。所以我们通过检查排序算法执行的指令数,来比较排序算法。所以应该选a。
错题5:Polymorphism is achieved by
A . overloading(重载)
B . overriding(重写)
C . embedding(嵌入)
D . abstraction(抽象)
E . encapsulation(封装)
分析:这道题考查的是多态性是通过什么实现,我选择的是的抽象,而答案是b重写:重写提供了多态性,因为适当的方法是根据当前被引用的对象而调用的,所以应该是重写实现多态性。
错题6: All run-time Errors throw Exceptions.
正确答案:B.false
原因:结果显而易见,如果我们用try-catch语句就可以不抛出了。
错题7:A try statement must have at least one catch statement, but could have many catch statements, and may or may not have a finally clause.
正确答案:A.true
原因:点错了,使用try之后必须要有至少一个catch,至少在IDEA中如果没有接下来的catch就会出现红线提示,finally是可有可无的,有需求就可以用。
教材学习中的问题和解决过程, 一个问题加1分
代码调试中的问题和解决过程, 一个问题加1分
基于评分标准,我给本博客打分:11分。得分情况如下:正确使用Markdown语法+1.教材学习中的问题和解决过程+2.代码调试中的问题和解决过程+2.感想,体会不假大空+1.错题学习深入+1.点评认真,能指出博客和代码中的问题+1.结对学习情况真实可信+1.课后题有验证+1,进度条有记录+1.
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 | |
第一周 | 200/200 | 2/2 | 20/20 | |
第二周 | 350/500 | 2/4 | 24/38 | |
第三周 | 512/1000 | 3/7 | 22/60 | |
第四周 | 1158/1300 | 4/9 | 35/90 | |
第五周 | 2905/3000 | 6/5 | 24/24 | |
第六周 | 3927/4000 | 2/2 | 26/30 |
20182327 2019-2020-1 《数据结构与面向对象程序设计》第六周学习总结
原文:https://www.cnblogs.com/kv888777/p/11679097.html