Error in project "Personal Library"

I’m getting an error and I just can’t figure it out.

Error: error: constructor Library in class Library cannot be applied to given types;
Library myLibrary = new Library(myBooks);
required: no arguments
found: HashMap<String,Boolean>
reason: actual and formal argument lists differ in length
Note: uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error


import java.util.HashMap;

public class Library {
public Library() {

public void getFinishedBooks() {
HashMap<String, Boolean> Library = new HashMap();
if (Library.size() < 1) {
System.out.println(“HashMap is empty.”);
else {
for(String book : Library.keySet()) {
if (Library.containsKey(true)) {
public static void main(String args) {
HashMap<String, Boolean> myBooks = new HashMap<String, Boolean>();

myBooks.put("Road Down The Funnel", true);
myBooks.put("Rat: A Biology", false);
myBooks.put("TimeIn", true);
myBooks.put("3D Food Printing", false);

Library myLibrary = new Library(myBooks);


Please help :slight_smile:

If you want your library constructor to accept an argument, then you’ll have to add a matching parameter.
If not, don’t give it any arguments.

See how this corresponds to the error message that you are getting?

I still can’t spot the problem… (Sorry I’m sooo very bad)

I’d like to think that I explained what the problem is, including how to fix it.