@@ -0,0 +1,766 @@
+package com.api.mutithread;%0A%0Apublic class ThreadViaRunnable implements Runnable%7B%0A%09Thread t;%0A%09ThreadViaRunnable()%7B%0A%09%09t = new Thread(this,%22Thread%22);%0A%09%09t.start();%0A%09%7D%0A%09%0A%09@Override%0A%09public void run() %7B%0A%09%09try %7B%0A%09%09%09for(int i=0;i%3C10;i++) %7B%0A%09%09%09%09Thread.sleep(1000);%0A%09%09%09%09System.out.println(%22In Thread %22+i);%0A%09%09%09%7D%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D arg) %7B%0A%09%09ThreadViaRunnable tvr = new ThreadViaRunnable();%0A%09%09try %7B%0A%09%09%09for(int i=0;i%3C10;i++) %7B%0A%09%09%09%09Thread.sleep(500);%0A%09%09%09%09System.out.println(%22Main Thread%22 + i);%0A%09%09%09%7D%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09try %7B%0A%09%09%09tvr.t.join();%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09System.out.println(%22Exit Main%22);%0A%09%7D%0A%09%0A%7D%0A

Create ThreadViaRunnable.java