Last active
February 6, 2023 10:51
-
-
Save nkchauhan003/e18934e89d189de792665bfdbb694093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package concurrency.creation; | |
public class ImplementRunnable { | |
public static void main(String[] args) { | |
// runnable instance | |
Runnable runnable = new RunnableImpl(); | |
// thread instance | |
Thread thread = new Thread(runnable); | |
// starting a thread | |
thread.start(); | |
} | |
private static class RunnableImpl implements Runnable { | |
@Override | |
public void run() { | |
System.out.println("Thread started: " + Thread.currentThread().getName()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment