Java Program to Create a Simple Interface

You are currently viewing Java Program to Create a Simple Interface

Java program to create a simple interface

// Java program to create a 
// simple interface

interface Inf {
  // public and abstract
  void sayHello();
}

public class Main implements Inf {
  public void sayHello() {
    System.out.println("Hello World");
  }

  public static void main(String[] args) {
    Main mObj = new Main();

    mObj.sayHello();
  }
}

Output

Hello World

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply