Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  inter.java
Language: JAVA
Code:
interface calc
{
public void add();
public void sub();
public void mul();
public void div();
}
class sample implements calc
{
public void add()
{
int a=2,b=3,c;
c=a+b;
System.out.println("c="+c);
}
public void sub()
{
int a=2,b=1;
System.out.println("a-b="+(a-b));
}
public void mul()
{
int a=2,b=1;
System.out.println("a*b="+(a*b));
}
public void div()
{
int a=2,b=1;
System.out.println("a/b="+(a/b));
}
}
class inter
{
public static void main(String b[])
{
sample a=new sample();
a.add();
a.sub();
a.mul();
a.div();
}
}          
Comments: