-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFun_Interface.java
More file actions
32 lines (32 loc) · 843 Bytes
/
Fun_Interface.java
File metadata and controls
32 lines (32 loc) · 843 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
// Functional interface
class data implements Runnable{
public void run(){
for(int i=1;i<=5;i++){
char ch=(char)(96+i);
System.out.println(ch);
try{
Thread.sleep(3000);
}catch (InterruptedException e){}
}
}
}
class Main{
public void main(String args[]) throws InterruptedException{
data d1=new data();
Thread t1=new Thread(d1);
t1.start();
//Ananymous function
Runnable r1=() ->
{
for(int i=0;i<7;i++){
System.out.println("JAVA");
try{
Thread.sleep(3000);
}catch(InterruptedException e){}
}
};
Thread t2=new Thread(r1);
t2.start();
System.out.println("End of Statement");
}
}