Reputation: 107
Is this possible in Java ?
public interface Document implements Serializable{ // a lot of method }
Upvotes: 0
Views: 108
Reputation:
Serializable is a class so you can only extend it not implement it.
public interface Document implements Serializable{ // a lot of method }
Upvotes: 1
Reputation: 4403
No, you have to use extends
:
import java.io.Serializable;
public interface Document extends Serializable {
// a lot of methods
}
Upvotes: 1
Reputation: 5782
Interfaces extend other interfaces and do not implement them.
So your code should read:
public interface Document extends Serializable { // a lot of method }
Upvotes: 0
Reputation: 7383
No, you have to extend it. "implements
" is only allowed for classes, which implement an interface.
public interface Document extends Serializable { // a lot of method }
Upvotes: 1