Search Java Code Snippets

  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.

#Java - Code Snippets for '#Runnable interface' - 1 code snippet(s) found

 Sample 1. Write a program to show thread usage in Java by implementing runnable interface

public class MyClass {
   static class MyThreadClass implements Runnable{

      public void start() {
         Thread t = new Thread(this,"threadName");
      public void run() {
         try {
            System.out.println("Hello Again");
         } catch (InterruptedException e) {
   public static void main(String[] args){
      MyThreadClass myThreadClass = new MyThreadClass();
      MyThreadClass myThreadClass2 = new MyThreadClass();

   Like      Feedback     Threads  runnable interface

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner