JDK 1.2 introduced
ThreadLocal class to maintain the thread’s local state. A thread may need to share some state with the classes in which it runs and a thread may have its own local state. To maintain such state in the thread-scope,
ThreadLocal can be used instead of declaring the state in the Thread class and using synchronization to share it.