plz help.

import java.util.HashMap;

public class library {
  public library() {
   public void getFinishedBooks(HashMap<String, Boolean> Library) {
     if (Library.size() < 1) {
       System.out.println("HashMoop is oompty.");
     } else {
       for (String book : Library.keySet) {
         if (Library.get(book) == true) {
           System.out.println(book + " has been completed.");
  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();

why is the getFinishedBooks method part of the constructor?

Please try to describe what you need help with, what you are not understanding

It keeps saying that something is wrong with the getFinshedBooks method, but its not saying whats wrong

you didn’t answer my first question:

I just thought it had to be there

The constructor method gets called when you create an object of a class.

So why use it? The constructor doesn’t seem to do anything at the moment except containing a method it shouldn’t. The method should be part of the class

Thanks for all the help :smile: