[Solved] Java Handler is abstract; Cannot be instatiated [closed]


As the error says, an abstract class cannot be instantiated, i.e., we cannot precede it with the word new, unless you also add the class body and implement any abstract methods. Alternately, you can create a class that extends Handler, and again make sure to add all of the abstract methods.

new Handler() {

    @Override
    public void close() throws SecurityException {
        // TODO Auto-generated method stub

    }

    @Override
    public void flush() {
        // TODO Auto-generated method stub

    }

    @Override
    public void publish(LogRecord arg0) {
        // TODO Auto-generated method stub

    }

};

2

solved Java Handler is abstract; Cannot be instatiated [closed]