我是一名新的 CS 专业学生,我正在努力理解一些概念,尤其是硬编码。
如果我有如下程序,这是硬编码吗?
抱歉,如果我没有正确提出问题
public class Dictionary {
enum Book {
Noun1("Book [noun] : A set of pages."),
Noun2("Book [noun] : A written work published in printed or electronic form."),
Verb1("Book [verb] : To arrange for someone to have a seat on a plane."),
Verb2("Book [verb] : To arrange something on a particular date.");
private String value;
Book(String s) { this.value = s; }
public String getValue() { return value; }
}
public static void main(String[] args) {
List<String> bookList = new ArrayList<String>();
for (Book bookValues : Book.values()) {
bookList.add(bookValues.getDefinition());
Map<String, Object> dictionary = new HashMap<>();
dictionary.put("book",bookList);
}