Skip to content

Commit 3c5af6d

Browse files
RameshRamesh
authored andcommitted
Merge branch 'master' of https://github.com/ramram43210/Java
2 parents d13bdfa + 8bb8b16 commit 3c5af6d

64 files changed

Lines changed: 156 additions & 175 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-------------------------------------
2+
If printTable method has synchronized block,
3+
then below will be the output:
4+
-------------------------------------
5+
6+
Thread Name = Thread 1
7+
5
8+
10
9+
15
10+
20
11+
25
12+
Thread Name = Thread 2
13+
50
14+
100
15+
150
16+
200
17+
250
18+
19+
-----------------------------------------
20+
If printTable method does not have synchronized block,
21+
then below will be the output:
22+
-----------------------------------------
23+
Thread Name = Thread 2
24+
50
25+
Thread Name = Thread 1
26+
5
27+
100
28+
10
29+
150
30+
15
31+
200
32+
20
33+
25
34+
250
35+
36+

Later/Thread/60/SynchronizationDemo/.classpath renamed to BasicJava/Synchronization_Block_Demo_App/SynchronizationDemo/.classpath

File renamed without changes.

Later/Thread/60/SynchronizationDemo/.project renamed to BasicJava/Synchronization_Block_Demo_App/SynchronizationDemo/.project

File renamed without changes.

Later/Thread/60/SynchronizationDemo/.settings/org.eclipse.jdt.core.prefs renamed to BasicJava/Synchronization_Block_Demo_App/SynchronizationDemo/.settings/org.eclipse.jdt.core.prefs

File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Later/Thread/62/SynchronizationDemo/src/SynchronizationDemo.java renamed to BasicJava/Synchronization_Block_Demo_App/SynchronizationDemo/src/SynchronizationDemo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ public class SynchronizationDemo
66
public static void main(String[] args) throws IOException
77
{
88
Table tableObj = new Table();
9-
Thread1 t1 = new Thread1(tableObj);
10-
Thread2 t2 = new Thread2(tableObj);
9+
Thread1 t1 = new Thread1(tableObj,"Thread 1");
10+
Thread2 t2 = new Thread2(tableObj,"Thread 2");
1111
t1.start();
1212
t2.start();
1313
}

Later/Thread/62/SynchronizationDemo/src/Table.java renamed to BasicJava/Synchronization_Block_Demo_App/SynchronizationDemo/src/Table.java

File renamed without changes.

0 commit comments

Comments
 (0)