forum

Home / DeveloperSection / Forums / Can you please explain this Thread working?

Can you please explain this Thread working?

Madam Walker181114-Oct-2013

Heres the code about threads.....I don't know the difference between those 2 new() statements.


  Runnable r=new Runnable() { 
    public void run() {
    System.out.print("Cat");
    }
    };
    Thread t=new Thread(r) {
    public void run() {
    System.out.println("Dog");
    }
    };
    t.start();



Output is Dog But why and how ?


Updated on 14-Oct-2013

Can you answer this question?


Answer

1 Answers

Liked By