20172325 2016-2017-2 《Java程序设计》第四周学习总结
20172325 2016-2017-2 《Java程序设计》第四周学习总结
教材学习内容总结
1.对类、对象、声明变量的定义和属性有了进一步的了解
2.学会如何编写一个类并运用到需要的程序中
3.学习了形参和实参的概念和区别
4.修饰符的作用和运用,例如public和private
5.学习了静态类,例如静态方法和静态变量
6.关于封装的作用和运用
7.在面向对象的程序设计时需要做的必要步骤,包括需求、设计、实现和测试
8.对枚举类的进一步了解
9.学习了调用方法中的方法重载
10.UML类图包含的内容和作用,有助于对类的理解
教材学习中的问题和解决过程
- 问题1:区分不了对象和类
问题1解决方案:首先是通过学习教材了解具体定义,然后百度具体区别,然后通过具体操作加深理解。下面是自己的理解,类是一个规则一个标准或者说一个模范,是一个虚拟的存在;对象是一个可变的的个体,有具体的需求和形态。而对象和类的联系在于对象的实现需要通过类来规范。
- 问题2:在形参和实参的理解和运用上很头疼
问题2解决方案:之前是在网上查询,可以参考这篇博客[(https://www.cnblogs.com/calence/p/5346672.html)]
后来老师在课上也给出了很详细的讲解。
代码调试中的问题和解决过程
- 问题1:对于getFaceValue和setFaceValue的作用不是很清楚,在敲例题4.2的时候,中间加了这两个方法和删除之后运行没有差别,不知道为何。
问题1解决方案:通过看书以后了解到,他们是同级的不同调用方法,内容不一样而已,这就是在设计时输入get和set先后顺序对于结果没有影响
问题2:如下图,不知道是什么情况,自从出现了这个东西,试了之前编译运行成功的程序也出现这样的结果。
代码托管
上周考试错题总结
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中变量只能包含一个值或一个引用。所以应该选a的。2.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,那么对象将变成一个“孤儿”。3.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
他们的长度永远不会改变,最短的字符串长度为零。字符串是不可变的。这意味着, 一旦创建了字符串对象, 就不能更改它。因此, 字符串的长度在创建后不会更改。最短长度字符串为 "", 引号之间没有字符, 因此长度为零。4.What happens if you attempt to use a variable before it has been initialized?
A A syntax error may be generated by the compiler
B A runtime error may occur during execution
C A "garbage" or "uninitialized" value will be used in the computation
D A value of zero is used if a variable has not been initialized
E Answers A and B are correct
编译器多次能够检测到未初始化变量的尝试使用, 在这种情况下会产生语法错误。如果编译器使用转义检测, 则在使用时会发生运行时错误。5.What is the function of the dot operator?
A It serves to separate the integer portion from the fractional portion of a floating point number
B It allows one to access the data within an object when given a reference to the object
C It allows one to invoke a method within an object when given a reference to the object
D It is used to terminate commands (much as a period terminates a sentence in English)
E Both B and C are correct
点算符的功能为:它允许在给定对象的引用时访问对象中的数据,当给定对象的引用时,它允许在对象中调用方法。所以这道题应该选e的。6.Unlike the String class where you must pass a message to an object (instance) of the class, as in x.length( ), in order to use the Math class, you pass messages directly to the class name, as in Math.abs( ) or Math.sqrt( ).
A .true
B .false
数学类使用被称为静态方法 (或类方法) 的方法, 通过将消息直接传递到类名本身而不是类的对象来调用。7.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
gen.nextInt(10) - 5 所得到的结果是-5,-4,-3,-2,-1,0,1,2,3,4,并不是题目中所要求的,它得到的只是一些数而不是一个取值范围。而nextFloat则是在范围[0,1)中产生伪随机数字;乘以10的收益率在0到10之间,再减去5,得到结果。8.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 objects
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
这两个声明都是合法的Java。s1是一个字符串引用,它被初始化为字符串“testing123”。s2是一个字符串引用,它被初始化为字符串“测试123”。注意“测试”和“123”之间的空格。所以这两个字符串不相等。9.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
当有两个或多个对同一物理对象的引用时,就会出现“别名”,这样,通过遵循任一引用,就可以读/写/修改对象10.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
如果两个字符串是完全一致的,那么它的值为0。11.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
伪随机数生成器相对于Math.random的优势在于:可以创建几个随机数生成器,可以在一个范围内生成随机的int,floats和ints。所以应该包括A与B。12.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
如果您不仅需要导入包的顶层, 而且还要输入所有的辅助级别, 则应编写: 导入包. ;(false);导入包.13.You may use the String replace( ) method to remove characters from a String.
A true
B false
replace()方法仅用其他单个字符替换单个字符。replace()方法不会将字符添加或删除字符串;字符串长度将保持不变14.All the methods in the Math class are declared to be static.
A true
B false
数学类方法被设计成在算术表达式中通常有用,因此不需要任何实例来使用它们。这是通过确保所有的数学方法都是静态的来实现的。15.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
所有随机数字生成器的效率是一样的。随机生成器优于数学的优点。随机包含所有其他属性。16.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
通过一个或多个数学方法,截断在程序员的手中“%”符号会出现在显示器的末端,而不是开始。
20172325 2016-2017-2 《Java程序设计》第四周学习总结的更多相关文章
- Java程序设计第四周学习总结
1. 本周学习总结 1.1 尝试使用思维导图总结有关继承的知识点. 1.2 使用常规方法总结其他上课内容. 答:①String类是final类,不能定义String的子类. ② instanceof ...
- 对于“2017面向对象程序设计(JAVA)第四周学习总结”存在问题的反馈
对于“2017面向对象程序设计(JAVA)第四周学习总结”存在问题的反馈 “这部分同学博文总结没有写,实验作业没有提交.”——1.关于博文作业.实验作业教学功能的正解:学习知识.暴露问题.衔接课上.2 ...
- 杨其菊201771010134《面向对象程序设计(java)》第四周学习总结
<面向对象程序设计(java)> 第四周学习总结 第一部分:理论知识 1.类与对象 a.类(class)是构造对象的模板或蓝图.由类构造对象的过程称为创建类的实例: java中类声明的格式 ...
- 201871010106-丁宣元 《面向对象程序设计(java)》第四周学习总结
201871010106-丁宣元 <面向对象程序设计(java)>第四周学习总结 正文开头 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-da ...
- 20155318 2016-2017-2 《Java程序设计》第九学习总结
20155318 2016-2017-2 <Java程序设计>第九学习总结 教材学习内容总结 学习目标 了解JDBC架构 掌握JDBC架构 掌握反射与ClassLoader 了解自定义泛型 ...
- 《Java程序设计》第二学习总结
<Java程序设计>第二学习总结 教材学习内容总结 类型 byte(字节) shot(短整型) int(整型) long(长整型) float(浮点型) double(双精度) char( ...
- 20145304 刘钦令 Java程序设计第二周学习总结
20145304 <Java程序设计>第2周学习总结 教材学习内容总结 java可区分基本类型和类类型(即参考类型)两大类型系统. 基本类型主要可区分为整数.字节.浮点数.字符与布尔. 整 ...
- 20145304 刘钦令 Java程序设计第一周学习总结
20145304<Java程序设计>第1周学习总结 教材学习内容总结 1995年5月23日,是公认的Java的诞生日,Java正式由Oak改名为Java. Java的三大平台是:Java ...
- 20145120黄玄曦 《java程序设计》 寒假学习总结
1和2.我对未来规划不多,我认为好好学习积累知识能帮助我应对未来的挑战,这是我的学习动力之一,此外,了解新知识满足好奇心也是我的主要的学习动力. 3.我认为专业课学习比公务员考试重要,我认为专业知识是 ...
- 201621123007 Java程序设计第一周 学习总结
第一周-Java基本概念 201621123007 <Java程序设计> 第一周学习总结 1. 本周学习总结 java是面向对象的一类语言,三大特征:封装性,继承性,多态性. jdk jr ...
随机推荐
- openvpn 上外网
Openvpn-2.2.2 实施记录 最终现象: Linux路由: [root@iZrj961wb7816wke73ql7qZ openvpm]# route -n Kernel IP routing ...
- linux系统分析工具之Blktrace
Blktrace简介: blktrace是一个针对Linux内核中块设备I/O层的跟踪工具,用来收集磁盘IO信息中当IO进行到块设备层(block层,所以叫blk trace)时的详细信息(如IO请求 ...
- 参加360前端星计划总结(二)--HTML&CSS
HTML学习手册(英文版)html:the living standard 重要知识点 文档声明的作用a. 指定html的文档标准和版本b. 告诉浏览器渲染模式,有怪异模式(较为古老的模式,不写文档声 ...
- DQL-联合查询
一.含义union:合并.联合,将多次查询结果合并成一个结果二.语法查询语句1union [all]查询语句2union [all]... 三.意义1.将一条比较复杂的查询语句拆分成多条语句2.适用于 ...
- Redis 之深入江湖-复制原理
一.前言 上一篇文章Redis 之复制-初入江湖中,讲了关于Redis复制配置,如:如何建立配置.如何断开复制.关于链接的安全性等等,那么本篇文章将深入的去说一下关于Redis复制原理,如下: 复制过 ...
- MongoDB相关操作
1. 连接MongoDB <?php //1.连接到MongoDB $host = "127.0.0.1"; $port = 27017; $server = " ...
- [iOS] Edit / Memo 原生控件才提供拼字检查
在 iOS 平台提供了英文拼字检查,但需将 ControlType 设定为 Platform 才能使用: 效果:
- Android ViewPager设置监听注意事项
首先 implements View.OnClickListener 因为Item比较多用这个方便 设置监听要注意地方,如果在 onCreate 直接 findViewById布局里的ID是会出错的 ...
- SQLAlchemy Table(表)类方式 - Table类和Column类
Table 构造方法 Table(name, metadata[, *column_list][, **kwargs]) 参数说明: name 表名 metadata 元数据对象 column_lis ...
- Redis--位图BitMap
一.BitMap是什么 通过一个bit位来表示某个元素对应的值或者状态,其中的key就是对应元素本身,value对应0或1,我们知道8个bit可以组成一个Byte,所以bitmap本身会极大的节省储存 ...