ThreadLocal.set(T value) has the following syntax.
public void set(T value)
In the following code shows how to use ThreadLocal.set(T value) method.
public class Main { public static void main(String[] args) { ThreadLocal<Integer> tlocal = new ThreadLocal<Integer> (); tlocal.set(100); System.out.println("value = " + tlocal.get()); } }
The code above generates the following result.