修改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

@ -12,7 +12,7 @@ package com.cpic.xim;
import com.cpic.xim.utils.MyThread;
import com.cpic.xim.utils.MyWorkingJob;
public class App
public class App
{
public static void main( String[] args )
{
@ -22,6 +22,6 @@ public class App
workThread.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();
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
public void run()
{
System.out.println("我是workingJobID是" + String.valueOf( Thread.currentThread().getId()));
System.out.println("我是workingJobID是" + String.valueOf( Thread.currentThread().threadId()));
}
}