作者:you_only89 | 来源:互联网 | 2023-08-27 23:14
学号2016-2017-2《程序设计与数据结构》第5周学习总结教材学习内容总结本章出现的概念:P100:对象的状态(属性)、行为(操作)P103:类的成员(数据和方法)P106:作用域;实例数据;
学号 2016-2017-2 《程序设计与数据结构》第5周学习总结
教材学习内容总结
本章出现的概念:
教材学习中的问题和解决过程
- 问题1:不理解静态方法的含义,若静态方法是通过类名来调用的,那非静态方法呢?
- 问题1解决方案:再仔细研究第三章的内容,与结对伙伴讨论、在网上查资料得出:
静态方法在创建对象前就可以使用了,非静态方法必须通过new出来的对象调用。也就是说,静态方法是在创建实例之前就存在了,而非静态方法是在创建对象之后才有的。
- 问题2:创建类的程序语句,如何创建类,具体的代码格式?如何运用自己创造的类?
- 问题2解决方案:仔细研究课本中程序5.2、5.4、5.7、5.9、5.11中的代码,与结对伙伴讨论,看云班课中视频,在网上查资料得出:
1.此类程序代码中包括类名、成员变量(
属性)、成员函数(方法)
2.运用对象之前需要先生成对象
(类名 对象名 = new 类名() )
云班课中视频教程学习内容总结
代码调试中的问题和解决过程
- 问题1:如何同时编译多个程序?
- 问题1解决方案:查笔记,问同学得出:
- javac -d bin src/05class/*.java
代码托管
(statistics.sh脚本的运行结果截图)
上周考试错题总结
- It is possible to store 11 elements in an array that is declared in the following way.(下面声明的数组中可以容纳11个元素)
int[] array = new int[10];
A .True B .False
An array declared as above can only store 10 elements.
- An array declared as an int[] can contain elements of different primitive types.(用int[]声明的数组,元素类型可以是所有基本类型)
A .True B .False
An array that has been declared with a specific type may only contain elements of that type. In this case the array can only contain integers.
- Multi-dimensional arrays that contain arrays of different lengths in any one dimension are called _________________.(包括不同长度数组的多维数组叫做_______)
A .ragged arrays(锯齿状数组) B .static arrays(静态数组) C . two-dimensional arrays(二维数组)
D .constant arrays(常量数组) E .overloaded arrays(重载数组)
Ragged arrays are multi-dimensional arrays that contain arrays at the same dimension with differing lengths.
- What is the precedence of the index operator ( [ ] ) relative to other operators in Java?(Java中,关于索引运算符[]的优先级,下面说法正确的是)
A.It has the lowest precedence of all Java operators.([ ] 优先级最低)
B.It has a higher precedence than addition, but a lower precedence than multiplication.([ ] 优先级比加法高,比乘法低)
C.It has a higher precedence than multiplication, but a lower precedence than addition. ([ ] 优先级比乘法高,比加法低)
D.It has the highest precedence of all Java operators.([ ] 优先级最高)
E.[ ] is not an operator.([ ] 不是运算符)
The index operator has the highest precedence of all Java operators.
- Which of the following lines of code accesses the second element of the first array in a two-dimensional array of integers, numbers, and stores the result in a variable called num?(下面哪条语句访问了一个整型二维数组numbers的第二个元素,并把值存入num变量中)
A.num = numbers[1][2];
B.num = numbers[0][1];
C.num = numbers.getElement(1, 2);
D.num = numbers.getElement(0, 1);
E.none of the above are correct
Choice b accesses the second element of the first array. Choice a accesses the third element of the second array. Choices c and d do not represent valid Java syntax.
- Which of the following method declarations correctly defines a method with a variable length parameter list?(下面哪个方法声明正确定义了一个变长参数的方法)
A.public int average(int[] list)
B.public int average(int ... list)
C.public int average(int ... list)
D.public int average(int a, int b, int c, ...)
E.public int average(integers)
The only choices with valid syntax are choice a and choice b. Choice a represents a method declaration with a single parameter, which is a reference to an array. Choice b correctly represents a valid declaration for a method with a variable length parameter list.
- Suppose we have an array of String objects identified by the variable names. Which of the following for loops will not correctly process each element in the array.(假如我们有一个名为names的String对象数组,下面哪个for循环不能遍历数组中的每一个元素?)
A.for(int i = 0; i
B.for(String name : names)
C.for(int i = 0; i
D.none of these will correctly process each element(以上都不能遍历)
E.all of these will correctly process each element(以上都能遍历)
Choice c will not process each element correctly due to a syntax error. The length variable is not a method and, therefore, does not have parenthesis after it. Choice b is an example of using a foreach loop to process an array, and choice a is a correct for loop.
- Which of the statements is true about the following code snippet?(对于下面的代码段,说法正确的是?)
int[] array = new int[25];
array[25] = 2;
A.The integer value 2 will be assigned to the last index in the array.(整数2会赋给数组中最后一个元素)
B.The integer value 25 will be assigned to the second index in the array.(整数25会赋给数组中的第2个索引)
C.The integer value 25 will be assigned to the third value in the array. (整数25会赋给数组中的第3个元素)
D.This code will result in a compile-time error.(代码会产生编译时错误)
E.This code will result in a run-time error. (代码会产生运行时错误)
This code will throw an ArrayIndexOutOfBoundsException, since the last index in this array will be 24. This causes a run-time error.
- An infinite loop is not a compile-time error.(无限循环不会产生编译时错误)
A.true B.false
An infinite loop is usually caused by a logical error, and will not be caught by the compiler.
结对及互评
点评过的同学博客和代码
- 本周结对学习情况
- 20162323周楠
- 结对学习内容
- 共同讨论理解书中的概念
- 共同讨论弄清书中示例程序代码的含义
- 共同讨论总结编写类的方法及运用
- 上周博客互评情况
- 20162304
- 20162321
- 20162323
- 20162330
其他(思考)
本周有所进步或改进:
- 本周改进了学习模式,本周按照娄老师推荐的学习模式:先看云班课中的教学视频,再研究教材中的内容,最后再通过代码来加深理解。
- 本章的新概念特别多,且不易理解,于是我将这些概念单独列出来,通过再仔细研究教材上字面意思,看云班课教学视频,与同学讨论,在网上查资料等方法对这些概念进行理解,最后再通过代码加深理解。
本周的不足与反思:
- 本周的学习积极性不够高,可能是由于上周学习太累,本周学生会工作任务重的原因吧,总之学习状态特别不好。希望能通过清明节假期的放松休息,及时调整心态,进一步优化学习方法,提高学习效率,做到又快又好。
学习进度条
目标 |
5000行 |
30篇 |
400小时 |
|
第一周 |
85/85 |
1/1 |
20/20 |
|
第二周 |
411/489 |
2/2 |
25/45 |
用Scanner输入数据 |
第三周 |
504/890 |
3/3 |
30/75 |
进一步加深对类、对象和方法等基本概念的理解 |
第四周 |
1175/2065 |
5/5 |
40/115 |
条件语句、循环语句、数组 |
第五周 |
841/2901 |
6/6 |
30/145 |
编写类 |
参考资料