I have to choose from several types of genres for books and I was thinking using enums for this, but there are several genres composed by two or more words like "Medical, Health & Fitness", "Art & Photography", "Science Fiction", etc.
public enum Genero {
Action, Comedy, Drama, Computers, Novel, Science Fiction
}
But I got a syntax error for "Science Fiction". I tried putting it with double quotes and simple quoutes, but neither worked. This enum is going to be use as a attribute for Book class.
No, it's not possible. Enum names must be valid Java identifiers - that means, no spaces. The usual convention is to declare enum names in all upper-case characters and separate words using an underscore, like this:
public enum Genero {
ACTION, COMEDY, DRAMA, COMPUTERS, NOVEL, SCIENCE_FICTION
}