【发布时间】:2013-11-19 10:47:38
【问题描述】:
protected enum Category { Action, Fiction, Drama, Romance, SciFi, Poems, Kids }
我已经创建了这个enum 类型,现在我必须为我的类创建一个构造函数。
public Book(String title, int code, List<String> authors, String publisher, int year, Category categ){
this.title = title;
this.code = code;
this.authors = authors;
this.publisher = publisher;
this.year = year;
this.category = ....;
}
我不明白如何将枚举类型的值传递给构造函数。
谁能帮忙?
我知道这是初学者的问题,但我似乎无法在任何地方找到答案。
【问题讨论】:
标签: java constructor enums