Java Topics
HubJava Collections FrameworkCollections Practice ProgramsComparable vs ComparatorGenericsIteratorArrayListLinkedListStackVectorHashMapHashtableLinkedHashMapTreeMapArrayDequeDeque Double-Ended QueuePriorityQueueHashSetLinkedHashSetTreeSetAdapter PatternBuilder PatternFactory PatternMVC PatternObserver PatternSingleton PatternDynamic ProgrammingGraphHashingHeapLinked List DSAQueue DSARecursionSearching AlgorithmsSorting AlgorithmsStack DSATime ComplexityTreesException Handling Best PracticesCustom ExceptionException Hierarchyfinally BlockException Handlingthrow aur throwstry-catchBuffered StreamsByte StreamsCharacter StreamsDeserializationFile ClassJava NIO New I/OSerializationArrays in JavaArray OperationsArray Practice ProgramsArray Interview QuestionsJagged ArrayMulti-Dimensional ArraysOne Dimensional Arraybreak aur continuedo-while Loopfor Loopif-else StatementsNested Loopsswitch-case Statementwhile LoopJava Compilation ProcessJava ki FeaturesPehla Java ProgramHistory of JavaJava EditionsJava Program StructureJDK, JRE aur JVMJava Kya Hai?Immutable StringsString Class in JavaString Interview QuestionsString MethodsString Practice ProgramsStringBufferStringBuilderComments in JavaData Types in JavaIdentifiers in JavaInput & Output in JavaJava KeywordsOperators in JavaType Casting in JavaVariables in JavaJava Coding Interview QuestionsCollections Interview QuestionsCore Java Interview QuestionsJDBC Interview QuestionsMultithreading Interview QuestionsOOPs Interview QuestionsSpring Framework Interview QuestionsJava 8 Date/Time APIDefault aur Static Methods in InterfaceFunctional InterfaceLambda ExpressionMethod ReferenceOptional ClassStream APIBatch ProcessingCallableStatementJDBC ArchitectureJDBC — Java Database ConnectivityJDBC Practice ProjectsMySQL ConnectionPreparedStatementResultSetStatement InterfaceTransaction ManagementCreating ThreadsDaemon ThreadExecutor FrameworkInter-Thread CommunicationMultithreading Practice ProgramsRunnable InterfaceSynchronizationThread ClassMultithreading IntroductionThread Life CycleThread PriorityJava Cheat SheetImportant Formulas & Key ConceptsImportant Java ProgramsJava Quick RevisionAbstract ClassAbstractionAnonymous ClassClass and ObjectConstructorEncapsulationInheritanceInner ClassInterfaceMethod OverloadingMethod OverridingObject ClassObject CloningObject-Oriented Programming OOPPolymorphismstatic Keywordsuper Keywordthis KeywordWrapper ClassesArray Practice ProgramsBasic Java Practice ProgramsCollection Practice ProgramsJDBC Practice ProgramsMultithreading Practice ProgramsOOPs Practice ProgramsPlacement Coding QuestionsString Practice ProgramsBanking SystemChat ApplicationE-Commerce Backend — Spring Boot REST APIEmployee Management SystemLibrary Management SystemSpring Boot Fullstack ProjectStudent Management SystemCookies in ServletExpression Language ELGenericServletHttpServletJavaServer Pages JSPJSP TagsMVC ArchitectureHttpServletRequest & HttpServletResponseServlet IntroductionServlet Life CycleSession TrackingDependency InjectionSpring BeansSpring CoreSpring FrameworkAPI GatewaySpring Cloud Config ServerDocker DeploymentEureka Server — Service DiscoverySpring Boot CRUD ApplicationException Handling in Spring BootJWT AuthenticationREST API in Spring BootSpring SecuritySpring BootSpring Data JPAValidation in Spring Boot
Thread Class
Last Updated : 26 May, 2026
title: Thread Class in Java
Multithreading35 words5 headingsExamples included
title: Thread Class in Java description: java.lang.Thread class ke methods
java.lang.Thread — thread banane aur control karne ki class.
Constructors
java exampleWoHoTech
Thread()
Thread(Runnable target)
Thread(String name)
Thread(Runnable target, String name)
Thread(ThreadGroup group, Runnable target)Important Methods
Static Methods
java exampleWoHoTech
Thread.currentThread() // Current thread reference
Thread.sleep(1000) // 1 second pause (throws InterruptedException)
Thread.yield() // Hint to scheduler to give others a chance
Thread.interrupted() // Check aur clear interrupted flag
Thread.activeCount() // Active threads count
Thread.enumerate(Thread[] arr) // All active threadsInstance Methods
java exampleWoHoTech
t.start() // Thread start karo
t.join() // Wait karo jab tak t khatam na ho
t.join(1000) // Max 1 second wait
t.interrupt() // Thread interrupt signal
t.isInterrupted() // Interrupted flag check (no clear)
t.isAlive() // Still running?
t.getName() // Thread naam
t.setName("Worker") // Naam set karo
t.getPriority() // Priority (1-10)
t.setPriority(7) // Priority set
t.isDaemon() // Daemon thread hai?
t.setDaemon(true) // Daemon banao (start se pehle)
t.getState() // Thread.State enum
t.getId() // Unique thread IDThread join() Example
java exampleWoHoTech
Thread t1 = new Thread(() -> {
System.out.println("T1 start");
try { Thread.sleep(2000); } catch (InterruptedException e) { }
System.out.println("T1 end");
});
t1.start();
t1.join(); // main thread wait karega jab tak t1 khatam na ho
System.out.println("Main continues after T1");Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Thread Class.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Java topic.
Search Terms
java, java programming, core java, java master course, java notes, master, course, multithreading
Related Java Topics
Continue learning this concept
MultithreadingCreating Threadstitle: Creating Threads in JavaMultithreadingDaemon Threadtitle: Daemon Thread in JavaMultithreadingInter-Thread Communicationtitle: Inter-Thread CommunicationMultithreadingMultithreading Introductiontitle: Thread IntroductionMultithreadingThread Life Cycletitle: Thread Life CycleMultithreadingThread Prioritytitle: Thread Priority in Java