How to get the current thread in Java

1 Answer

0 votes
package javaapplication1;
 
public class JavaApplication1 {

    public static void main(String[] args) {
 
         Thread currentThread = Thread.currentThread();
         System.out.println(currentThread);
    }
}
 
/*

run:

Thread[main,5,main]

*/

 



answered Oct 14, 2016 by avibootz

Related questions

1 answer 281 views
1 answer 156 views
156 views asked Jan 29, 2024 by avibootz
1 answer 183 views
183 views asked Jan 29, 2024 by avibootz
...