define a custom interface jav code example
Example 1: define a custom interface jav
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) {
}
}
Example 2: define a custom interface jav
interface methods{
public static hey();
}
class scratch implements methods{
public static hey(){
System.out.println("Hey");
}
}