Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged

Sp7 #206

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions 51 Chapter8/Interface/Interfaces_Can_Be_Extended.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package Interface;

// One interface can extend another.
interface A{

void meth1();
void meth2();
}

// B now includes meth1() and meth2() - it adds meth3().
interface B extends A{ // B inherits A.
void meth3();
}

// This class must implement all of A and B
class MyClass implements B{

@Override
public void meth1() {
// TODO Auto-generated method stub
System.out.println("Implement meth1(). ");
}

@Override
public void meth2() {
// TODO Auto-generated method stub
System.out.println("Implement meth2(). ");
}

@Override
public void meth3() {
// TODO Auto-generated method stub
System.out.println("Implement meth3(). ");
}
}


public class Interfaces_Can_Be_Extended {

public static void main(String[] args) {
// TODO Auto-generated method stub

MyClass obMyClass = new MyClass();

obMyClass.meth1();
obMyClass.meth2();
obMyClass.meth3();

}

}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.