-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFuncInterf.java
More file actions
27 lines (27 loc) · 805 Bytes
/
Copy pathFuncInterf.java
File metadata and controls
27 lines (27 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
* Three types of the interfaces :
* 1.Normal interface (It has more than one abstract method)
* 2.Functional interface(Single abstract interface) (It has only one abstract method)
* 3.Marker interface (It has no methods)
*/
@FunctionalInterface
/*
* This is called an annotational. This is not mandatory
* but when we use this annotational called Functional-
* Interface allows us do not insert more than one method
* because functionlalinterface means having only one method
*/
interface FuncInterface
{
void ucan();
}
public class FuncInterf
{
public static void main(String[] args)
{
FuncInterface obj = () -> System.out.println("Nothing is impossible");
// We can create like this using lambda expression(->)
//It is only applicable to FunctionalInterface
obj.ucan();
}
}