Java contains Interfaces, Classes and Objects. Distinguishing between each can be slightly difficult at first, but I will explain exactly what a Java interface is in the post.

Firstly, I’d like to start with a short definition of the word “Interface”.

A device or program enabling a user to communicate with a computer.

Given this definition, we know that an Interface is a medium between a user and a computer.

Now, you might be asking, what does an interface look like in Java?

Interfaces look like Classes. However, on their own, their purpose is slightly different.

//This is how you make an interface..

interface LeInterface{

    public void doSomething();
    public void doSomethingElse();


//Then, a class can implement the interface...
public class MyClassBro implements LeInterface{

    //Firstly, it must declare the same methods as are in the interface...
    public void doSomething(){
    public void doSomethingElse(){
        System.out.println("Something.... Else... MWUAHAHAHHAHA");

    //Then, we can make a little main..
    public static void main(String[] args){

        //Then we can make a new Object of type "LeInterface", BUT make it an object of MyClassBro()!
        LeInterface oooWhatsThis = new MyClassBro();
        //And, we can run these methods...



We would set the file name to the name of the class in this case. However, you may still be wondering WHAT IS HAPPENING.

To put this in the most simple and sweet manner: An Interface forces the class that implements it to contain the methods laid out in the interface.

So, let’s say we want a Coffee to implement a Hot Drink interface. In the Hot drink interface, we can set some methods equating to:

  • Temperature
  • Water
  • Milk
  • Sugar
  • Ingredients[]

That way we can always be sure that the hot drinks are implementing the right methods!

You don’t want coffee to not have any water in do you? No.

I hope this explains interfaces for you in a beautiful manner!

Until next time, Josh.

Leave a Reply
You May Also Like

Haskell: List Comprehension; Generators, Guards, Examples

Being able to manipulate lists is really important in any language. Haskell…

eBay Bitcoin: Can you Sell Bitcoin on eBay?

Technically yes, you can sell Bitcoin on eBay. You can sell various…