The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
Questions and Exercises: Object-Oriented Programming Concepts问题和练习:面向对象编程概念
Questions问题
Real-world objects contain ___ and ___.现实世界中的对象包含状态和行为。
A software object's state is stored in ___.软件对象的状态存储在字段中。
A software object's behavior is exposed through ___.软件对象的行为通过方法公开。
Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as data ___.对外部世界隐藏内部数据,并仅通过公开的方法访问它,称为数据封装。
A blueprint for a software object is called a ___.软件对象的蓝图称为类。
Common behavior can be defined in a ___ and inherited into a ___ using the ___ keyword.公共行为可以在一个超类中定义,并使用extends关键字继承到一个子类。
A collection of methods with no implementation is called an ___.没有实现的方法集合称为接口。
A namespace that organizes classes and interfaces by functionality is called a ___.按功能组织类和接口的名称空间称为包。
The term API stands for ___?术语API代表应用程序接口?
Exercises练习
Create new classes for each real-world object that you observed at the beginning of this trail.为在本教程开始时观察到的每个真实对象创建新类。Refer to the Bicycle class if you forget the required syntax.如果忘记了所需的语法,请参考Bicycle
类。
For each new class that you've created above, create an interface that defines its behavior, then require your class to implement it.对于上面创建的每个新类,创建一个定义其行为的接口,然后要求您的类实现它。Omit one or two methods and try compiling.省略一个或两个方法,然后尝试编译。What does the error look like?错误看起来像什么?
Check your answers.检查你的答案。