Interface or abstract class?

Generally speaking, the approach I use in this kind of situation is to have both an interface and an abstract class. The interfaces defines, well, the interface. The abstract class is merely a helper. You really can’t go wrong with this approach. Interfaces give you the flexibility to change implementation. Abstract classes give you boilerplate … Read more

Java abstract interface

Why is it necessary for an interface to be “declared” abstract? It’s not. public abstract interface Interface { \___.__/ | ‘—-> Neither this… public void interfacing(); public abstract boolean interfacing(boolean really); \___.__/ | ‘—-> nor this, are necessary. } Interfaces and their methods are implicitly abstract and adding that modifier makes no difference. Is there … Read more

What is the difference between an abstract method and a virtual method?

An abstract function cannot have functionality. You’re basically saying, any child class MUST give their own version of this method, however it’s too general to even try to implement in the parent class. A virtual function, is basically saying look, here’s the functionality that may or may not be good enough for the child class. … Read more

Precise definition of “functional interface” in Java 8

From the same page you linked to: The interface Comparator is functional because although it declares two abstract methods, one of these—equals— has a signature corresponding to a public method in Object. Interfaces always declare abstract methods corresponding to the public methods of Object, but they usually do so implicitly. Whether implicitly or explicitly declared, … Read more