zoukankan      html  css  js  c++  java
  • 20172318 《程序设计与数据结构》第三周学习总结

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

    教材学习内容总结

    学习到了创建string对象的方法和简化语法以及使用length等方法
    了解了import导入Java包中的概念
    学会了使用random类以及math类
    了解了numberformat类和decimalformat类的使用区别和方法
    学会使用枚举型enum编写程序
    简单了解了自动装箱的知识

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

    • 问题1:对string的含义有点模糊
    • 问题1解决方案:看了些资料大致了解了string类用于描述字符串事物,提供了多个方法对字符串进行操作方法

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

    • 问题1:编写pp3.3程序时使用+运算符会将两个数字相加而不是相连

    • 问题1解决方案:将数字间隙加上“”

    • 问题2:对于pp3.8中产生整形随机数而后产生各种值,这些数值我原先都定义成一种类型,后来程序无法运行

    • 问题2解决方案:分别使用int和double定义整数值以及三角函数值

    代码托管

    上周考试错题总结

    • 错题1
      Consider the following statement:
      System.out.println("1 big bad wolf 8 the 3 little pigs 4 dinner 2night");
      This statement will output ________ lines of text (思考下面的语句,该语句将输出___行文本)
      A . 1
      B . 2
      C . 3
      D . 4
      E . 5
      "表示一个制表符,虽然跟在 后的句子会输出在下一行,但光标会停在本行;
      " "后的句子会输出在下一行,同时光标也会移动至下一行。
      " "不会表示回车符,不会将句子移至下一行。
    • 错题2
      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类型,所以会发生运行时错误)
      因为这个为整形除法0.5只能输出0
    • 错题3
      Which of the following is true regarding the mod operator, %? (关于求余运算符%,下面哪项是正确的?)
      A . It can only be performed on int values and its result is a double (它只能执行int类型的数值,其结果是double类型的数)
      B . It can only be performed on int values and its result is an int (它只能执行int类型的数值,其结果也是int类型的数)
      C . It can only be performed on float or double values and its result is an int (它只能执行float或者double类型的数值,其结果是int类型的数)
      D . It can only be performed on float or double values and its result is a double (它只能执行float或者double类型的数值,其结果是double类型的数)
      E . It can be performed on any numeric values, and the result always is numeric (它可以执行任何类型的数值,其结果始终是数值)
      通常用于整型但可以用于任何类型数值
    • 错题4
      What value will z have if we execute the following assignment statement?
      int z = 50 / 10.00; (如果我们执行下面的赋值语句,z将得到什么值?)
      A . 5
      B . 5.0
      C . 50
      D . 10
      E . none of the above, a run-time error arises because z is an int and 50 / 10.00 is not (以上皆错,因z是一个整型数而50 / 10.00不是,会产生运行时错误)
      因为10不是int,所以除法产生一个不能存储在int中的双精度值,除法的结果必须在存储在z之前作为int被转换,否则在除法发生之前,值10首先必须被转换为int
    • 错题5
      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 (变量存在于程序中时允许改变类型,但只能缩窄转换)
      强类型是一种编程语言的属性,在变量存在时,变量的类型不改变,存储在该变量中的任何值都是该类型的。强类型之所以重要,是因为它保证成功编译的程序不会出现与声明变量相关的类型错误的运行时错误。

    学习进度条

    代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
    目标 5000行 30篇 400小时
    第一周 128/128 1/1 12/12
    第二周 212/340 1/2 18/30
    第三周 206/546 1/3 20/50
  • 相关阅读:
    Tomcat单独部署,控制台乱码解决方法
    mysql授权访问数据库
    Arrays.binarySearch采坑记录及用法
    使用Spring Ehcache二级缓存优化查询性能
    Redis批量删除缓存数据
    Java并发包之Semaphore用法
    Java并发包之CountDownLatch用法
    如何用Xshell导出文件到桌面本地
    Semaphore信号量原理
    老应用链接替换到新链接
  • 原文地址:https://www.cnblogs.com/m1sty/p/8647223.html
Copyright © 2011-2022 走看看