Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Functional Interface - Java 8

    • 0
    • 2
    • 0
    • 2
    • 0
    • 0
    • 0
    • 0
    • 1.06k
    Comment on it

    The interface with only a single methods is known as functional interface. If an interface marked as @FunctionalInterface it can only contains one abstract method. If we try to declare more than one abstract method inside FunctionalInterface compiler will produce the error.

    For example -

    @FunctionalInterface
    public interface MyDemoFunctionalInterface {
     public abstract void display();
    }
    

    The above example is correct and will compile successfully, but the below example cannot be compiled and will throw the error:

    @FunctionalInterface
    public interface MyDemoFunctionalInterface
    {
      public abstract void display();
      public abstract void show();
    }
    

    Hope this will help you :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: