Runnable: run : Runnable « java.lang « Java by API






Runnable: run

/*
 * Output:
 *  run
 */

class caller implements Runnable {
  String msg;


  public caller(String s) {
    msg = s;
    new Thread(this).start();
  }

  public void run() {
    System.out.println("run");
  }
}

public class MainClass {
  public static void main(String args[]) {
    new caller("Hello");
  }
}
           
       








Related examples in the same category