Lab 19
AIM: Write a program that illustrates interface inheritance. Interface P12 inherits from both P1 and P2. Each interface declares one constant and one method. The class Q implements P12 . Instantiate Q and invoke each of its methods. Each method displays one of the constants.

InterfaceExample.java
interface P
{
    final int p=5;
    void dispP();
}
interface P1 extends P
{
    final int p1=10;
    void dispP1();
}
interface P2 extends P
{
    final int p2=20;
    void dispP2();
}
interface P12 extends P1,P2
{
    final int p12=12;
    void dispP12();
}
class Q implements P12
{
    public void dispP()
    {
        System.out.println("dispP : "+p1);
    }
    public void dispP1()
    {
        System.out.println("dispP1 : "+p2);
    }
    public void dispP2()
    {
        System.out.println("dispP2 : "+p12);
    }
    public void dispP12()
    {
        System.out.println("dispP12 : "+p);
    }
    
}
class InterfaceExample
{
    public static void main(String arg[])
    {
        Q q=new Q();
        q.dispP();
        q.dispP1();
        q.dispP2();
        q.dispP12();
    }
}

Output
interface example in java output
Interface Example in java by practical server

Happy Coding :)