0:00

What best describes the purpose of a class’s constructor?

构造函数的主要用途是初始化field,并不是分配内存空间。
1

Under which of these conditions is it appropriate to overload a method (ie: the class will contain two methods with the same name)?

重载指的是同名method接受不同参数。
5

Which of the following statements about a class that contains an abstract method is (are) true?

I. You can’t have any constructors in this class.
II. This class must be declared as abstract.
III. You can’t declare any fields in this class.

abstract method需要在abstract class中。
2

Which of the following is true about abstract classes?

abstract class可以被继承,无法创建object。
1

A car dealership needs a program to store information about the cars for sale. For each car, they want to keep track of the following information: number of doors (2 or 4), whether the car has air conditioning, and its average number of miles per gallon. Which of the following is the best design?

numDoorshasAirmilesPerGallon等信息适用包含关系,可作为Car的field。
3

A program is being written by a team of programmers. One programmer is implementing a class called Employee; another programmer is writing code that will use the Employee class. Which of the following aspects of the public methods and fields of the Employee class does not need to be known by both programmers?

面向对象编程的精髓在于method的实现细节是个黑盒子。
1

A bookstore is working on an on-line ordering system. For each type of published material (books, movies, audio tapes) they need to track the id, title, author(s), date published, and price. Which of the following would be the best design?

使用PublishedMaterial作为parent class,BooksMovies作为child class,TitlePriceIDAuthorsDatePublished等作为field是最好的设计。
3


陈 欣

AADPS创始人

发表评论