Program to illustrate interface inheritance concept

import java.io.*;
interface intface1
{ int j=20;
int j1( ); }
interface intface2
{ double k1( ); }
interface intface3 extends intface1,intface2
{ Boolean l1( ); }
class sample implements intface3
{
public int j1() { return 100; }
public double k1( ) { return 20.9; }
public Boolean l1( ) { return true; }
}
public class intfacedemo2
{ public static void main(String[] args)
{
sample s = new sample();
System.out.println(s.j);
System.out.println(s.j1());
System.out.println(s.k1());
System.out.println(s.l1());
}
}
o/p
20
100
20.9
true

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.