# 题目9 在ObjectOrientedBook类中,实现一个构造方法`public ObjectOrientedBook(String bookName, BookType type, int pages, double price, boolean recommended);`,方法的作用是在父类相同的构造方法的基础上,同时实现将recommended属性设置成参数中recommended的值。 ## 答案 ```java public class ObjectOrientedBook extends Book { private boolean recommended; public ObjectOrientedBook(String bookName, BookType type, int pages, double price, boolean recommended) { super(bookName, type, pages, price); this.recommended = recommended; } } ``` ## 选项