JHTP自测题_第八章_深入理解类和对象
来源:互联网 发布:淘宝hd最新版本 编辑:程序博客网 时间:2024/05/22 15:51
Self-Review Exercise
8.1Fill in theblanks in each of the following statements:
a) A(n)static importon demand imports all staticmembers of a class.
b)Stringclassstaticmethodformatis similar to method System.out.printf, but returns a formatted Stringrather thandisplaying aStringin a command window.
c) If a method contains alocal variable with the same name as one of its class’s fields, the localvariableshadows the field in that method’s scope.
d) Thepublicmethods of aclass are also known as the class’spublic services or interfaces.
e) A(n)single-type-importdeclaration specifies one class to import.
f) If a class declaresconstructors, the compiler will not create a(n)no-argument constructor.
g) An object’stoStringmethod is called implicitly when an object appears in code where aStringis needed.
h)Getmethods arecommonly calledaccessor or query method.
i) A(n)predicate methodtests whether a condition is true or false.
j) For everyenum, thecompiler generates astaticmethod calledvalues that returns an array of the enum’s constantsin the order in which they were declared.
k) Composition issometimes referred to as a(n)has-a relationship.
l) A(n)enum declarationcontains a comma-separated list of constants.
m) A(n)static variablerepresents classwide information that’s shared by all the objects of the class.
n) A(n)single-type-importdeclaration imports one staticmember.
o) Theprinciple of leastprivilege states that code should be granted only the amount of privilegeand access that it needs to accomplish its designated task.
p) Keywordfinal specifiesthat a variable is not modifiable after initialization in a declaration orconstructor.
q) A(n)type-import-on-demanddeclaration imports only the classes that the program uses from a particular package.
r)Setmethods arecommonly calledmutator because they typically change a value.
s) Use BigDecimal classto perform precise monetary calculations.
t) Use thethrow statement to indicate that a problem hasoccurred.
- JHTP自测题_第八章_深入理解类和对象
- JHTP自测题_第六章_深入理解方法
- JHTP小结_第八章_深入理解类和对象
- JHTP自测题_第十一章_深入理解异常(Exception Handling)
- JHTP自测题_第三章_类、对象、方法及字符串简介
- JHTP自测题_第十五章_文件、流和对象序列化(Files, Streams, and Object Serialization)
- JHTP自测题_第十三章_图形及Java2D
- JHTP自测题_第九章_面向对象编程-继承(Inheritance)
- JHTP自测题_第十章_面向对象编程-多态(Polymorphism)
- JHTP自测题_第十二章_GUI组件(上篇)
- JHTP自测题_第四章_控制语句Part 1-赋值、++、--运算符
- JHTP自测题_第五章_控制语句Part 2-逻辑运算符
- JHTP自测题_第七章_数组及动态数组(Array and ArrayList)
- JHTP自测题_第二章_Java应用、输入、输出及运算符简介
- JHTP小结_第六章_深入理解Methods(方法)
- JHTP练习题及课题_第六章_深入理解方法 (附加一些感慨)
- JHTP小结_第十一章_深入理解异常(Exception Handling)
- JHTP自测题_第十四章_字符串、字符及正则表达式(Strings, Characters and Regular Expressions)
- 怎么实现ZBrush中的布尔运算的运用
- H5与Android IOS 交互
- jquery 复制节点clone(),clone(true)
- activity生命周期详解
- 【打CF,学算法——四星级】CodeForces 689D Friends and Subsequences (RMQ+二分)
- JHTP自测题_第八章_深入理解类和对象
- SQL自定义函数split分隔字符串
- 快速排序
- SceneKit一个3D场景角色的代码重构
- 学习UML实现、泛化、依赖、关联、聚合、组合
- jquery remove(),detach(),empty()
- 幸福
- 用JQuery实现Ajax的简单小应用
- MyEclipse10下Spring依赖注入的简单方法