-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLamda_java.java
More file actions
38 lines (36 loc) · 945 Bytes
/
Copy pathLamda_java.java
File metadata and controls
38 lines (36 loc) · 945 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
28
29
30
31
32
33
34
35
36
37
38
package BASICS;
interface DemoAno{
void meth1(int a);
// void meth2();
}
class AnoDemo implements DemoAno{
public void display(){
System.out.println("Hello");
}
@Override
public void meth1(int a) {
System.out.println("hii");
}
// @Override
// public void meth2() {
// }
}
public class Lamda_java {
public static void main(String[] args) {
// DemoAno d = new DemoAno() { //Annonymous class
// @Override
// public void meth1() {
// System.out.println("Byee");
// }
//
// @Override
// public void meth2() {
//
// }
// };
// d.meth1();
DemoAno ad = (a)->{System.out.println("This is lemda function" + a);}; //this can only be used when there is
//only method in interface
ad.meth1(4);
}
}