import java.util.LinkedList;

import static java.lang.System.*;

class Cannon {
    String name;
    public boolean loaded;


    public Cannon(String name, boolean loaded) {
        this.name = name;
        this.loaded = loaded;
    }
    public String getName() {
        return name;
}
    public boolean fire() {
        if (loaded == true) {
            out.println("Cannon loaded");
        } else {
            out.println("Load cannon");
        }
return loaded;
    }
}


public class Program {
    public static void main(String[] args) {
        LinkedList<Cannon> cannons = new LinkedList<>();
        cannons.add(new Cannon("cannon1", true));
        cannons.add(new Cannon("cannon2", false));
        cannons.add(new Cannon("cannon3", false));
        cannons.add(new Cannon("cannon4", true));
        cannons.add(new Cannon("cannon5", false));
        cannons.add(new Cannon("cannon6", true));

                out.println("NIezaładowane działa");
        for (Cannon cannon : cannons) {
            if (cannon.fire() == false) {
                out.println(cannon.getName());
            }
        }
    }
}
I want to see which cannons are not loaded and I should load the unloaded ones but I haven't gotten to that step yet