how to implement interface in java with example
Example 1: java interface
public interface Exampleinterface {
public void menthod1();
public int method2();
}
class ExampleInterfaceImpl implements ExampleInterface {
public void method1()
{
//code here
}
public int method2()
{
//code here
}
}
Example 2: creating the functional interface in java
package com.concretepage;
@FunctionalInterface
public interface Calculator {
long calculate(long num1, long num2);
}