0
public class ExmpleThrd {

    private static class InnerThrd implements Runnable {
        public void run() {
            System.out.println("Running Concurent Thread...!!!");
            System.out.println("its implementing Runnable interface...");
        }
    }

    public static void main(String[] args) {
        //Thread t = new Thread(new InnerThrd());
        //t.start();
        InnerThrd in = new InnerThrd();
        in.run();
    }
}

output:::::

Running Concurent Thread...!!! It is implementing Runnable Interface.!!!

beresfordt
  • 5,088
  • 10
  • 35
  • 43
  • What happens in you call the `run` method of the `Runnable`? Basically the same thing. `start` schedules a thread to execute, which, at some point in the future, will call the `run` method of the `Thread`, which calls the `run` method of the `Runnable` – MadProgrammer Mar 11 '16 at 09:24
  • 2
    Calling `start` will make the`run` method execute in the `InnerThrd` thread. Calling `run` directly will make `run` execute in the current thread. – Arnaud Mar 11 '16 at 09:25
  • 1
    When you call run(), the same thing happens as any other method you call, run() is called in the current thread. There is nothing special or different about how this method works. – Peter Lawrey Mar 11 '16 at 09:45

0 Answers0