Skip to content

Commit 142f7f2

Browse files
Java Thread
1 parent 003e051 commit 142f7f2

7 files changed

Lines changed: 700 additions & 0 deletions

File tree

Basics/Design Pattern/Bridge Pattern/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@
1414
<natures>
1515
<nature>org.eclipse.jdt.core.javanature</nature>
1616
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1664908487928</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
1728
</projectDescription>

Basics/Design Pattern/Template Pattern/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@
1414
<natures>
1515
<nature>org.eclipse.jdt.core.javanature</nature>
1616
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1664908487944</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
1728
</projectDescription>

Basics/Thread/ThreadJoin.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
public class ThreadJoin extends Thread{
2+
3+
public void run () {
4+
5+
Thread t = Thread.currentThread();
6+
System.out.println("Started Executing " +t.getName());
7+
8+
for(int i=0; i <10; i++) {
9+
10+
System.out.println(t.getName() + i);
11+
12+
}
13+
14+
System.out.println("Finished Executing " +t.getName());
15+
16+
}
17+
18+
public static void main(String[] args) throws Exception{
19+
20+
Thread t = new Thread (new ThreadJoin(), "New Thread");
21+
t.start();
22+
System.out.println("Started executing main thread");
23+
24+
t.join();
25+
26+
27+
for(int i =0; i<10; i++) {
28+
29+
System.out.println(Thread.currentThread().getName() +i);
30+
31+
}
32+
33+
System.out.println("Finished Executing " +Thread.currentThread().getName());
34+
35+
}
36+
37+
38+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
public class ThreadNotifyTest {
2+
3+
public static void main (String args[]) {
4+
5+
ThreadNotifyTest threadnotifytest = new ThreadNotifyTest();
6+
7+
Thread t1 = new Thread1(threadnotifytest, "New Thread1");
8+
Thread t2 = new Thread2(threadnotifytest, "New Thread2");
9+
Thread t3 = new Thread3(threadnotifytest, "New Thread3");
10+
11+
t1.start();
12+
t2.start();
13+
t3.start();
14+
15+
16+
17+
18+
19+
}
20+
21+
22+
23+
24+
}

Basics/Thread/ThreadYield.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
public class ThreadYield extends Thread {
2+
3+
public void run() {
4+
5+
Thread t = Thread.currentThread();
6+
System.out.println("Started Executing " +t.getName());
7+
8+
for(int i=0; i<10; i++) {
9+
10+
System.out.println(t.getName() + i);
11+
12+
}
13+
14+
System.out.println("Finished Executing " +t.getName());
15+
16+
}
17+
18+
public static void main(String args[]) throws Exception {
19+
20+
Thread t = new Thread(new ThreadYield(),"New Thread");
21+
t.start();
22+
23+
System.out.println("Started executing main thread");
24+
25+
t.yield();
26+
27+
for(int i= 0; i<10; i++) {
28+
29+
System.out.println(Thread.currentThread().getName() +i);
30+
31+
}
32+
33+
System.out.println("Finished Executing " +Thread.currentThread().getName());
34+
35+
36+
}
37+
38+
39+
40+
}

Past Papers/Mock paper Answers-20211018/Mock Esay Answers/Designpattern3/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@
1414
<natures>
1515
<nature>org.eclipse.jdt.core.javanature</nature>
1616
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1664908487937</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
1728
</projectDescription>

0 commit comments

Comments
 (0)