Easy learning with example program codes

how to get current thread in java?

The currentThread() method of Thread class is used to get current thread in java. It is a static method.
Syntax of currentThread() method:

public static Thread currentThread()

It returns a reference to the currently running thread.

Get current thread example

package com.codesjava;
public class Test {
	public static void main(String args[]){
		Thread currentThread = Thread.currentThread();



Related Topics:

Please follow and like us:
Posted in Java   

Core Java Tutorial

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki