Possible Duplicate:
Why would one declare a Java interface method as abstract?
The following code snippet defines an abstract interface and does the sum of two numbers entered through the console.
package abstractinterface;
import java.util.Scanner;
abstract interface SumInterface
{
abstract public void sum();
}
final class Summation implements SumInterface
{
private int x,y;
public Summation(int x, int y)
{
this.x=x;
this.y=y;
}
public void sum()
{
System.out.print("\nSummation = "+(x+y)+"\n\n");
}
}
final public class Main
{
public static void main(String[] args)
{
try
{
Scanner s=new Scanner(System.in);
System.out.print("\nEnter a number:->");
int x=s.nextInt();
System.out.print("\nEnter another number:->");
int y=s.nextInt();
new Summation(x, y).sum();
}
catch(NumberFormatException ex)
{
System.err.println(ex.getMessage());
}
}
}
The interface contains one abstract method and it is implemented by the class Summation. The only question here is that if the keyword abstract is removed from the above interface, does it make some different sense? What is the actual use of such abstract interfaces in Java?