write an application that creates an interface and implement it code example
Example 1: interface in java
interface Animal {
public void eat();
public void travel();
}
Example 2: how to declare a interface in java
interface Appendable {
void append(string content);
}
class SimplePrinter implements Appendable {
public void append(string content) {
System.out.println(content);
}
}
class FileWriter implements Appendable {
public void append(string content) {
}
}
0
how to implement a interface in java