Update ThreadDeadLockTestCase_2.java

This commit is contained in:
IcyFenix 2021-09-23 10:12:35 +08:00 committed by GitHub
parent 145c82003c
commit 54c165d7bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,9 +8,9 @@ public class ThreadDeadLockTestCase_2 {
/**
* 线程死锁等待演示
*/
static class SynAddRunnalbe implements Runnable {
static class SynAddRunnable implements Runnable {
int a, b;
public SynAddRunnalbe(int a, int b) {
public SynAddRunnable(int a, int b) {
this.a = a;
this.b = b;
}
@ -27,8 +27,8 @@ public class ThreadDeadLockTestCase_2 {
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
new Thread(new SynAddRunnalbe(1, 2)).start();
new Thread(new SynAddRunnalbe(2, 1)).start();
new Thread(new SynAddRunnable(1, 2)).start();
new Thread(new SynAddRunnable(2, 1)).start();
}
}