Interface In Java Programming – An Example

An interface in java is a collection of abstract methods and constant identifiers. There are no defined methods and  no fields. From that definition, if a class provides method definitions for an interface’s methods, the class is said to implement the interface. The class may also define other methods. In this post, we will see how to use an interface in java.

interface in java

The Example – An Interface In Java

In this example, we will create an interface called Employee for all the employees in a company. The information read in for each employee in question consists of employee’s name and gross pay. So, we need to list the responsibilities of the interface that will help us define the methods’ specifications. In other words, the responsibilities means the services provided to users of any class that implements the Employee interface. So here they are:

How To Build Simple Counter Android App

In my first android app development post, I showed how you could easily create a simple to do list application from scratch. In this post however, we are going deeper or one step further by creating a Counter App that will change a value as well as the background color depending on which button is clicked. If you asking yourself of a use case, I am thinking of a scenario where you are playing family games and you want to keep score count. You can reset to zero when you are starting over. Pretty fun right? Let us look at the final product before writing some code: