Java - Interface

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public interface Animal {
     
    public void makeASound();
 
}
 
public class Dog implements Animal {
 
    public void makeASound() {
        System.out.print("bark");
    }
 
    public static void main(String args[]){
        Dog dog = new Dog();
 
        dog.makeASound();
   }
 
}

Result:

bark