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
Runnable Interface
Last Updated : 26 May, 2026
title: Runnable Interface in Java
Multithreading85 words4 headingsTables includedExamples included
title: Runnable Interface in Java description: Runnable interface ka use aur Thread se comparison
java exampleWoHoTech
@FunctionalInterface
public interface Runnable {
void run();
}Kab Use Karein?
- Jab class already kisi aur class ko extend kar rahi ho
- Thread functionality chahiye par inheritance nahi
- Lambda se thread banana ho (Java 8+)
Example
java exampleWoHoTech
class Worker implements Runnable {
private String task;
Worker(String task) { this.task = task; }
@Override
public void run() {
System.out.println(Thread.currentThread().getName() + " performing: " + task);
try { Thread.sleep(500); }
catch (InterruptedException e) { Thread.currentThread().interrupt(); }
System.out.println(task + " completed!");
}
}
// Multiple threads same Runnable share kar sakte hain
Worker worker = new Worker("Download");
Thread t1 = new Thread(worker, "Worker-1");
Thread t2 = new Thread(worker, "Worker-2");
t1.start();
t2.start();Lambda Runnable
java exampleWoHoTech
Runnable r = () -> System.out.println("Lambda task: " + Thread.currentThread().getName());
new Thread(r).start();
new Thread(r).start();Thread vs Runnable
| extends Thread | implements Runnable | |
|---|---|---|
| -- | -- | -- |
| Inheritance | Class kisi aur ko extend nahi kar sakti | Class freely extend kar sakti hai |
| Object sharing | Alag objects | Same object multiple threads mein |
| Recommended | No | Yes |
| OOP | Tight coupling | Loose coupling |
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Runnable Interface.
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 JavaMultithreadingExecutor Frameworktitle: Executor Framework in JavaMultithreadingInter-Thread Communicationtitle: Inter-Thread CommunicationMultithreadingMultithreading Practice Programstitle: Multithreading ProgramsMultithreadingSynchronizationtitle: Synchronization in Java