Error message ‘Cannot be resolved or is not a field’

Right now I’m studying the chain of responsibility design pattern and am using Eclipse.

And I’m trying to compile this code, but I have the compiling error “isLast cannot be resolved or is not a field”:

public class OverFive implements Discount {
    private Discount next; //
    public boolean isLast = false;

    public void setNext(Discount next, boolean Last) { = next; = Last; // Here is the error.

    public double DoDiscount(Budget budget) {
        if (budget.getValue() > 500) {
            return budget.getValue() * 0.10;
        if ( == false) {
            return next.DoDiscount(budget);
        else {
            return 0;

And now, here is the interface:

public interface Discount {

    double DoDiscount(Orcamento orcamento);
        void setNext(Discount next, boolean Last);

Leave a Comment