Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anonymous class error [closed]

public interface IMethodCallback 
{
    boolean Execute();
}

...

IMethodCallback callback = new IMethodCallback
            {
                boolean Execute()
                {
                    return false;
                }
            };

This results in errors. How can I make something like this in Java?

like image 818
Ivan Prodanov Avatar asked Jan 01 '26 08:01

Ivan Prodanov


1 Answers

You miss the parentheses of the constructor:

IMethodCallback callback = new IMethodCallback()
{
    public boolean Execute()
    {
        return false;
    }
};
like image 120
Eng.Fouad Avatar answered Jan 03 '26 22:01

Eng.Fouad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!