Skip to content

Instantly share code, notes, and snippets.

@nkchauhan003
Last active February 6, 2023 10:51
Show Gist options
  • Save nkchauhan003/e18934e89d189de792665bfdbb694093 to your computer and use it in GitHub Desktop.
Save nkchauhan003/e18934e89d189de792665bfdbb694093 to your computer and use it in GitHub Desktop.
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