Documentation

The Java™ Tutorials
Hide TOC
Questions and Exercises问题和练习
Trail: Learning the Java Language
Lesson: Object-Oriented Programming Concepts

Questions and Exercises: Object-Oriented Programming Concepts问题和练习:面向对象编程概念

Questions问题

  1. Real-world objects contain ___ and ___.现实世界中的对象包含状态行为
  2. A software object's state is stored in ___.软件对象的状态存储在字段中。
  3. A software object's behavior is exposed through ___.软件对象的行为通过方法公开。
  4. Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as data ___.对外部世界隐藏内部数据,并仅通过公开的方法访问它,称为数据封装
  5. A blueprint for a software object is called a ___.软件对象的蓝图称为
  6. Common behavior can be defined in a ___ and inherited into a ___ using the ___ keyword.公共行为可以在一个超类中定义,并使用extends关键字继承到一个子类
  7. A collection of methods with no implementation is called an ___.没有实现的方法集合称为接口
  8. A namespace that organizes classes and interfaces by functionality is called a ___.按功能组织类和接口的名称空间称为
  9. The term API stands for ___?术语API代表应用程序接口

Exercises练习

  1. 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类。
  2. 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.检查你的答案。


Previous page: What Is a Package?
Next page: Language Basics