I came across the following Java code. Here the interface contains two methods, of which only one method is implemented in the enumeration. It is written that name() is executed automatically. My question is how is this possible? Previously, I did not read any rules regarding the automatic implementation of a method in enum. So what's going on here? In addition, the code does not give any compile-time error.
interface Named { public String name(); public int order(); } enum Planets implements Named { Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune;
source share