EN
Java - interface extends multiple interfaces
1 answers
2 points
Can single interface extends multiple interfaces in java?
xxxxxxxxxx
1
public interface A {
2
// ...
3
}
4
5
public interface B {
6
// ...
7
}
8
9
public interface C {
10
// ...
11
}
Is there a way that C extends A and B?
1 answer
1 points
Yes, we just need to use extends
keyword, separating parent interfaces using comma separator.
Example:
xxxxxxxxxx
1
public interface A {
2
void print();
3
}
4
5
public interface B {
6
void printNewLine();
7
}
8
9
public interface C extends A, B {
10
// ...
11
}
0 commentsShow commentsAdd comment