- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLambdaExample.java
More file actions
Latest commit
21 lines (16 loc) · 525 Bytes
/
Copy pathLambdaExample.java
File metadata and controls
21 lines (16 loc) · 525 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//before java8 using classes for implementing method interfaces(which has only one abstract methods and any default or static methods)
//class Square implements Shape{
// @Override
// public void draw(){
// System.out.println("Square is drawn");
// }
//}
publicclassLambdaExample {
publicstaticvoidmain(String[] args){
Shaperectangle = () -> System.out.println("rectangle drawn");
print(rectangle);
}
publicstaticvoidprint(Shapeshape){
shape.draw();
}
}