i did a simple interface programme where one interface extends two interface.so,no error is showing,but no output is showing..here is the code..

interface a
{
    int add(int x,int y);
}
interface b
{
int mul(int x,int y);

}

interface c extends a,b
{
int div(int x,int y);

}


class d implements c
{
public int add(int x,int y)
{
    return(x+y);
}

    public int mul(int x,int y)
    {
    return(x*y);
}

public int div(int x,int y)
{
    return(x/y);
}
}

 public class cd
{

    public static void  main(String[] args) {
    d e= new d();
    e.add(15, 5);
    e.mul(5, 7);
    e.div(49, 7);
    }

  }

Class source file is cd.java.can u plz tell me why the output is not showing?and what error i have done in the code?Thanks

Recommended Answers

All 2 Replies

There's no code there that displays anything. You have not written any code to display any output. So there is no output.

You forgot to write print statements such as

System.out.println("add: " + e.add(15,5));

Thank you very much james..really i forgot to write print statement....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.