What is the need for an interface to have abstract methods?

4

We know that in an interface the methods have no implementation, just signing, that is, just defining their methods without the body, we conclude that all are already abstract methods, right? But then why are there statements like:

interface Exemplo {
    void umMetodo();

    abstract void outroMetodo();
}


class ImplementaExemplo implements Exemplo {

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

    }

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

    }

}

What is the need for an abstract method in an interface? Would it have relationship exclusively to create the possibility of functional interface?

    
asked by anonymous 03.01.2018 / 02:13

1 answer

6
  

We know that in an interface the methods have no implementation

Not true .

  

What is the need for an abstract method in an interface?

None. Totally redundant. Methods in interfaces are abstract, unless explicitly declared as default .

  

Would you have relationship exclusively to create the possibility of functional interface?

The convention adopted by some people is that a functional interface must be explicitly declared as abstract, differing from a normal interface. But the only real constraint is that it must have only one method to be used in lambdas . I have the impression that the convention started to be used for lack of knowledge of how the mechanism works since they speak in abstract methods.

    
03.01.2018 / 02:23