Java class extends clause comes before implements clause

The following class failed to compile with either JDK 5 or 6:
import java.io.Serializable;

public class ImplementsExtendsOrder implements Serializable extends Object {
}

\jdk6\bin\javac ImplementsExtendsOrder.java
ImplementsExtendsOrder.java:7: '{' expected
public class ImplementsExtendsOrder implements Serializable extends Object {
^
1 error
It turned out when declaring a java class, the extends clause has to come before implements clause. The error message about missing {did lead me to check matching {} many times without finding anything.

The correct way to declare such a class is to put implements clause before extends clause:
import java.io.Serializable;

public class ImplementsExtendsOrder extends Object implements Serializable {
}
Tags: ,

Followers

Pageviews Last 7 Days