修改getId为threadId。

This commit is contained in:
unknown 2023-12-12 00:35:10 +08:00
parent 12ad1d5a4b
commit 2e97a395c4
3 changed files with 4 additions and 4 deletions

View File

@ -22,6 +22,6 @@ public class App
workThread.start(); workThread.start();
jobThread.start(); jobThread.start();
System.out.println( "我是主线程!" + String.valueOf(Thread.currentThread().getId()) ); System.out.println( "我是主线程!" + String.valueOf( Thread.currentThread().threadId() ) );
} }
} }

View File

@ -16,6 +16,6 @@ public class MyThread extends Thread
{ {
super.run(); super.run();
System.out.println("我是工作线程:" + String.valueOf(Thread.currentThread().getId()) ); System.out.println("我是工作线程:" + String.valueOf(Thread.currentThread().threadId()) );
} }
} }

View File

@ -15,6 +15,6 @@ public class MyWorkingJob implements Runnable
@Override @Override
public void run() public void run()
{ {
System.out.println("我是workingJobID是" + String.valueOf( Thread.currentThread().getId())); System.out.println("我是workingJobID是" + String.valueOf( Thread.currentThread().threadId()));
} }
} }