java - Creating a thread via implementing runnable interface -


A thread can be created through implementing runnables

  implemented the public class program Does Runnable {public Zero Run} {System.out.println ("Thread in progress"); } Public static zero main (string arguments []) {program p1 = new program (); New thread (P1). Start (); // We can also use (new thread (new program). Start ();}}  

Is one like the other?

  program p1 = new program (); new thread (p1) .start (); // If the thread and the next thread share the same runnable frequency / share, they also share areas of the level of the level, thus one of them can change the status of the new thread (P1). Start (); // also Can use Start (); // This creates a new example of the program / runnab, so it does not share the same object.  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -