zoukankan      html  css  js  c++  java
  • 20172303 2017-2018-2 《程序设计与数据结构》第4周学习总结

    20172303 2017-2018-2 《程序设计与数据结构》第4周学习总结

    教材学习内容总结

    • 第四章:
      • 学会了简单的编写类
      • 了解了UML类图(真的很有用!!!!)
      • 了解了return语句的用法
      • 明白了形参与实参的区别
    • 第七章:
      • 了解了软件开发活动的过程
      • 了解了静态变量和静态方法
      • 了解了变量之间的依赖关系和聚合关系
      • 学会了this引用
      • 了解了接口的相关方法
      • 学会了枚举类型的使用
      • 了解了如何测试代码

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

    • 问题1:看到第七章时有些分不清静态变量和实例变量
    • 问题1解决方案:自己查了相关资料:
      • 语法区别:静态变量需要static关键字修饰,实例变量不需要。
      • 程序运行时的区别:静态变量从属于类,实例变量从属于对象。
      • 实例变量必须创建了实例对象,其中的实例变量才会被分配空间,才能使用这个实例变量;静态变量即类别量,只要程序加载了类的字节码,静态变量就会被分配空间,即可使用。
      • 综上,实例变量必须创建对象后通过这个对象来使用,静态变量可以直接使用类名来引用。

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

    • 问题1:在做例4.3时,显示的结果全是“+name”
    • 问题1解决方案:修改了很多次最后发现是最后一句少加了一个引号_(:з」∠)_

    代码托管

    上周考试错题总结(正确为绿色,错误为红色)

    • 错题1: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
    • 原因:没看清题目问的是什么
    • 理解情况:java的变量包含对实例类的值或引用。
    • 错题2:Which properties are true of String objects?
      • A . Their lengths never change
      • B . The shortest string has zero length
      • C . Individual characters within a String may be changed using the replace method
      • D . The index of the first character in a string is one
      • E . Only A and B are true
    • 原因:对String的理解不足,觉得B是对的,但觉得A不对,所以没有选E...
    • 理解情况:字符串是不可变的。这意味着一旦创建了一个字符串对象,它就不能被改变。
    • 错题3:In the StringMutation program shown in Listing 3.1, if phrase is initialized to "Einstein" what will Mutation #3 yield if Mutation #1: mutation1 = phrase.concat(".")?
      • A . Einstein.
      • B . EINSTEIN.
      • C . XINSTXIN.
      • D . einstein.
      • E . xinstxin.
    • 原因:把题目当成了单纯地一步,没有理解它其实是类似书上例3.1中的一部分。
    • 理解情况:题目中的方法在原句的基础上加了一个“.”,但接着之后做完的话,第三步会将所有E换为X。
    • 错题4:Which of the following will yield a pseudorandom number in the range [ -5, +5 ) given the following:
      Random gen = new Random( );
      • A . gen.nextFloat( ) * 5
      • B . gen.nextFloat( ) * 10 - 5
      • C . gen.nextFloat( ) * 5 - 10
      • D . gen.nextInt( ) * 10 - 5
      • E . gen.nextInt(10) - 5
    • 原因:错在了整型与浮点型的选择上(ー`´ー)
    • 理解情况:int产生的是[-5,+4]之间的。
    • 错题5: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
    • 原因:理解有问题。
    • 理解情况:听老师上课讲过之后知道了这两个都是合法的,但第一个中间没有空格。
    • 错题6:The String class' compareTo method
      • A . compares two string in a case-independent manner
      • B . yields true or false
      • C . yields 0 if the two strings are identical
      • D . returns 1 if the first string comes lexically before the second string
      • E . none of the above
    • 原因:当时没学到compareTo方法,所以不是很懂_(:з」∠)_
    • 理解情况:看过了第七章之后学会了compareTo方法,compareTo可以比较两个数的大小,当两个数相等时输出“0”。
    • 错题7:Java.text's NumberFormat class includes methods that
      • A . allow you to format currency
      • B . allow you to format percentages
      • C . round their display during the formatting process
      • D . truncate their display during the formatting process
      • E . A, B, C, but not D
    • 原因:我也不知道当时为什么要选C...可能是英语理解有问题。
    • 理解情况:NumberFormat类提供了通用的数据格式化能力。
    • 错题8:The advantages of the DecimalFormat class compared with the NumberFormat class include
      • A . precise control over the number of digits to be displayed
      • B . control over the presence of a leading zero
      • C . the ability to truncate values rather than to round them
      • D . the ability to display a % automatically at the beginning of the display
      • E . only A and B
    • 原因:在敲这个例题的时候对B感触很深,但A感触不是很深
    • 理解情况:虽然DecimalFormat的确提供了比NumberFormat更多的控制,但截断仍然通过一个或多个Math方法掌握在程序员手中。%符号将出现在显示的末尾而不是开头。
    • 错题9:When comparing any primitive type of variable, == should always be used to test to see if two values are equal.
      • A . true
      • B . false
    • 原因:对==的理解不到位。
    • 理解情况: double和float不能使用==来测试。
    • 错题10:If you need to import not only the top-level of a package, but all its secondary levels as well, you should write: import package..;
      • A . true
      • B . false
    • 原因:用IDEA敲代码的时候不认真...每一个java文件的开头都有这句。
    • 理解情况:导入语句只能与一个*(通配符)一起使用。如果您还需要导入包的所有辅助级别,则必须明确写出它们。
    • 错题11:The printf method within System.out is designed to ease the conversion of legacy C code into Java.
      • A . true
      • B . false
    • 原因:在没有查任何资料的情况下想当然地认为它是对的。
    • 理解情况:C程序使用C printf函数进行输出。Java的printf方法紧跟在C printf函数之后,所以C输出语句可以非常容易地转换成Java。。

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

    • 这周明显感觉难度上去了,刚开始敲书上的代码时先敲得前面的发现不能运行,后来发现要先敲后面的再敲前面的_(:з」∠)_做后面的作业也不像之前那么容易了,但是感觉会用java做的事情越来越多了也是一种成就感。

    学习进度条

    代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
    目标 5000行 30篇 400小时
    第一周 120/120 1/1 9/9
    第二周 246/366 1/2 9/18
    第三周 785/1121 2/4 15/33
    第四周 615/1736 1/5 20/53
    • 计划学习时间:20小时
    • 实际学习时间:24小时
    • 改进情况:本周学习内容多,所以学习时间有所加长

    参考资料

  • 相关阅读:
    字典--------输出有序的格式
    输出数据和数据下标的两种方法
    删除操作
    搭建RabbitMQ环境(windows)
    SpringBoot 2.x 集成 Redis
    Redis 安装
    Spring Boot 数据库操作
    默认日志Logback配置
    通过poi下载图片到word
    Spring IoC 与 AOP
  • 原文地址:https://www.cnblogs.com/PFrame/p/8719755.html
Copyright © 2011-2022 走看看