码迷,mamicode.com
首页 > 其他好文 > 详细

《数据结构与面向对象程序设计》第2-3周学习总结

时间:2019-09-22 23:17:32      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:总结   tps   允许   命令   ali   别名   定义   就会   lan   

学号20182329 2019-2020-1 《数据结构与面向对象程序设计》第2-3周学习总结

教材学习内容总结

  • 条件语句和循环语句的使用
  • 输入语句和输出语局应用
  • 基本数据类型的转换和应用
  • 各种类的使用方法,以及格式化输出的方法。
  • 基本的类的编写

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

  • 问题1:scanner输入时用short nextShort()输入时出现异常。
  • 问题1解决方案:输入时应与前一项自己指定的数据类型一样才可以。
  • 问题2:在应用impoet时使用import Java.util.*时并不会是添加我需要使用的包。
  • 问题2解决方案:后来发现时java.lang*才会将所有的包都自动映入每一个程序,但最好在引用一个包时使用import的单独声明。
  • 问题3:使用枚举类时按照书上的操作cone3.NAME进行调用,但是发现无法输出。
  • 问题3解决方法:在声明后,在计算机内部每一个枚举类型都保存为一个整数值,所以我一卡使用double类型声明,且使用小数会损失数据。

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

  • 问题1:在编译时发现如图----找不到类的错误。技术图片

  • 问题1解决方案:我在编写时将setpogyrightdate自己设定的方法当作类进行运算,所以找不到类
  • 问题2:找不到book的变量。技术图片

  • 问题2解决方案:是因为toString在使用类时应该(新变量名).toString()。
  • 问题3:使用如图文件进行测试时发现无法返回数值技术图片

  • 问题3解决方法:没有进行测试值输入,而是进行Scanner输入;其次return返回值在循环里,而这个循环又没有必要,不是合格程序。

代码托管

(statistics.sh脚本的运行结果截图)
技术图片

上周考试错题总结

  • In Java a variable may contain
    A
    .
    a value or a reference
    B
    .
    a package
    C
    .
    a method
    D
    .
    a class
    E
    .
    any of the above
    解析:英文不过关,理解错了reference的意思。java的变量包含对实例类的值或引用。
  • If two variables contain aliases of the same object then

    A . the object may be modified using either alias

    B . the object cannot be modified unless there‘s but a single reference to it

    C . a third alias is created if/when the object is modified

    D . the object will become an "orphan" if both variables are set to null

    E . answers A and D are correct

    解析:别名提供了一种可以修改对象的方法。如果这两个变量被设置为null,那么对象不被任何变量引用(通过任何别名)
  • An "alias" is when

A . two different reference variables refer to the same physical object

B . two different numeric variables refer to the same physical object

C . two different numeric variables contain identical values

D . two variables have the same names

E . none of the above

解析:alias是别名,有两个或多个引用指向同一物理对象时,就会发生“别名”。

  • These two ways of setting up a String yield identical results:

a) String string = new String(12345);

b) String string = new String("12345");

A . true

B . false

解析:用new是()里的String类必须带引号,不然不能编译

  • The printf method within System.out is designed to ease the conversion of legacy C code into Java.

A . true

B . false

解析:英文理解错误,我理解是对比,实际上是代码进入。

  • The advantage(s) of the Random class‘ pseudo-random number generators, compared to the Math.random method, is that

A . you may create several random number generators

B . the generators in Random are more efficient than the one in Math.random

C . you can generate random ints, floats, and ints within a range

D . you can initialize and reinitialize Random generators

E . all but answer B

解析:英文理解不足。随机发生器在Math.random的优点包括所有其他属性。

  • Consider the following two lines of code. What can you say about s1 and s2?
    String s1 = "testing" + "123";

String s2 = new

String("testing 123");

A . s1 and s2 are both references to the same String object

B . the line declaring s2 is legal Java; the line declaring s1 will produce a syntax error

C . s1 and s2 are both references to different String objects

D . s1 and s2 will compare "equal"

E . none of the above

解析:s1和s2都是合法的,但是加号不适用。

  • 错题二What value will z have if we execute the following assignment statement? float z = 5 / 10; (如果我们执行下面的赋值语句,得到的z将会是什么值?)

A . z will equal 0.0 (z将等于0.0)

B . z will equal 0.5 (z将等于0.5)

C . z will equal 5.0 (z将等于5.0)

D . z will equal 0.05 (z将等于0.05)

E . none of the above, a run-time error arises because z is a float and 5 / 10 is an int (以上都不对,因为z是float类型,5 / 10是int类型,所以会发生运行时错误)

解:对于float行的小数计算,析等式右边是一个整数型的除法,所以结果舍弃小数部分,得到0,进行扩展类型转换后就得到了0.0.

  • What is output with the statement System.out.println(""+x+y); if x and y are int values where x=10 and y=5? (如果x和y是int类型的数值,x=10,y=5,那么语句System.out.println(""+x+y);的输出是什么?)

A . 15

B. 105

C . 10 5

D . x+y

E . An error since neither x nor y is a String (因x和y都不是字符串而引起的一个错误)。

解析:将代码Java运算得105

  • Java is a strongly typed language. What is meant by "strongly typed"? (Java是一种强类型语言。“强类型”指的是什么?)

A.Every variable must have an associated type before you can use it (在使用变量之前,每个变量一定都有一个与之关联的类型)

B.Variables can be used without declaring their type (变量可以在不声明其类型的情况下使用)

C.Every variable has a single type associated with it throughout its existence in the program, and the variable can only store values of that type (在程序中,每个变量都有一个与之关联的类型,而变量只能存储该类型的值)

D.Variables are allowed to change type during their existence in the program as long as the value it currently stores is of the type it is currently declared to be (变量存在于程序中时允许改变类型,只要它当前存储的值是当前声明的类型)

E.Variables are allowed to change types during their existence in the program but only if the change is to a narrower type (变量存在于程序中时允许改变类型,但只能缩窄转换)

解析:课本定义没有理解

  • Assume that x, y, and z are all integers (int) equal to 50, 20, and 6 respectively. What is the result of x / y / z? (假设x、y和z都是整型数(int),分别等于50、20和6。那么x / y / z的结果是什么?)

A
.
0

B
.
12

C
.
16

D
.
A syntax error as this is syntactically invalid (由于语法无效产生的语法错误)

E
.
A run-time error because this is a division by 0 (由于除0产生的运行时错误)

解析:这道题的运算顺序是从左到右,50/20=2, 2/6=0;其中没有除0,错的原因是做题不认真。

结对及互评

评分标准

  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分

点评模板:

  • 博客中值得学习的或问题:
    • 本博客在修改上次考试错题的方面下了很大功夫,学习了linux中许多命令,理解了linux中命令的多用法。
    • 但是博客在课本自学方面存在一点问题,并没有将所有知识点列出,只是课本编程实列的学习问题的解决。
    • 本博客在代码调试问题的环节中积极解决问题,掌握Java在linux环境下的许多编程细节。
  • 代码中值得学习的或问题:
    • 因为本周学习都是第一章的简单输出编程,所以问题几乎没有,只是在编程格式上尽可能美观方便,方便修改。
    • 本博客存在设置类(标识符)时的错误,希望改正。
  • 基于评分标准,我给本博客打分:10分。得分情况如下:
  • 正确排版要素齐全(+1)
  • 使用makedown格式(+1)
  • 教材问题(+3)
  • 代码调试问题(+3)
  • 错题深入(+1)
  • 点评认真(+1)

  • 参考示例

点评过的同学博客和代码

  • 本周结对学习情况
    • 20182324
    • 结对照片
    • 结对学习内容
      • 条件语句和循环语句的使用
      • 输入语句和输出语局应用
      • 基本数据类型的转换和应用
      • 各种类的使用方法,以及格式化输出的方法。
  • 上周博客互评情况

其他(感悟、思考等,可选)

在我看来是对C语言知识在Java程序上的套用,首先条件语句和循环语句几乎和C语言一模一样,各种if语句,while语句等等都一样;其次测试代码就像C语言中的主函数和分函数一样,在期间传递对象的值。其次我对Java学习渐渐有了心得,不外乎就是多练和多看,多练可以熟悉掌握不会忘记,多问可以排查知识点漏洞,这样java学习可以更加得心应手。

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 107/107 2/2 15/15
第二周 454/526 2/4 32/47

尝试一下记录「计划学习时间」和「实际学习时间」,到期末看看能不能改进自己的计划能力。这个工作学习中很重要,也很有用。
耗时估计的公式:Y=X+X/N ,Y=X-X/N,训练次数多了,X、Y就接近了。

  • 计划学习时间:35小时

  • 实际学习时间:32小时

  • 改进情况:在周六周天假期少一点玩,多打几行代码。

参考资料

《数据结构与面向对象程序设计》第2-3周学习总结

标签:总结   tps   允许   命令   ali   别名   定义   就会   lan   

原文地址:https://www.cnblogs.com/lyz182329/p/11569786.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!