/*
* Java Interface Examples
/
// Declaring the interface with a method declaration
interface intDemo
{
public void sayWelcome();
}
// create class and implements the interface using the keyword "implements"
public class DemoInterface implements intDemo
{
// defining the methods which is declared in the interface
public void sayWelcome()
{
System.out.println("Welcome here");
}
public static void main(String[] args)
{
// create object for the class
DemoInterface demointerface=new DemoInterface();
//invoke the sayWelcome() .which is declared in intDemo interface
demointerface.sayWelcome();
}
}
Output:::
Welcome here
* Java Interface Examples
/
// Declaring the interface with a method declaration
interface intDemo
{
public void sayWelcome();
}
// create class and implements the interface using the keyword "implements"
public class DemoInterface implements intDemo
{
// defining the methods which is declared in the interface
public void sayWelcome()
{
System.out.println("Welcome here");
}
public static void main(String[] args)
{
// create object for the class
DemoInterface demointerface=new DemoInterface();
//invoke the sayWelcome() .which is declared in intDemo interface
demointerface.sayWelcome();
}
}
Output:::
Welcome here