[Java] Interface
In Java, interfaces are a special reference type that has the following properties: May contain constants (variables that are implicitly public, static, and final). May contain method signatures, but no method bodies. Interfaces cannot be instantiated, but can be implemented. In other words, an interface provides a blueprint for its implementing classes. When a group of programmers work on a software, it's often useful to specify a contract that defines how different components of the software interact, so that the programmers can work on separate parts of the software concurrently. Interfaces serve perfectly for this purpose. To define an interface, we use the interface keyword: 1 2 3 4 5 6 7 8 public interface Animal { public void eatSomething (); public String makeSomeNoise (); public int getSize (); } Here, I just defined an Animal interface which has three methods. To implement this interface, we can use the implements keywor...