Your static
block is off, and you’re missing any import
(s). Java doesn’t have a named dictionary parameter syntax, it should look something like
private static Set<Book> books; // do not use raw-types
static {
books = new HashSet<>(); // diamond operator
books.add(new Book(1, "C++", 10, "ABC")); // need to close the .add() call
books.add(new Book(2, "Java", 20, "DEF"));
}
public static Set<Book> allBooks() {
return books;
}
And make sure you
import java.util.HashSet;
import java.util.Set;
solved Expected ‘}’ but eof found [closed]