I came across the following java code. Here interface contains two methods out of which only one method is implemented in the enum. It is written that name() is implemented automatically. My question is how is it possible? I have not read any rule regarding automatic method implementation in enum before. So what is happening here? Furthermore the code is not giving any type of compile time error.

In Java, there are attributes and methods which are pre-defined for types. For enums, the method name() and for arrays, the attribute length are examples. In your example, the method name() would return "Mercury", "Venus", "Earth" and so on.