java - Different of Thread start() -


In research of previous project coding:

I found out that the thread was used in 2 different ways Can be

first

  timerTratt tt = new timerite (); Tt.start ();   

Second

  timerTratt tt = new timerite (); New thread (TT) Start ();   

Is there a difference between these 2 codes?

Jeffrey,

Yes, The first option created a new timerath object and allocated it to TT handle. After that, starting with that handle (to start) method.

The second option created a new timeradad object and handed it in TT handle. Then in the second row, another new thread object was created and handed it over to Tited Headle, and then reached the start () method through that "New Thread Object", thus making the orbitation made in the first line orphaned .

The only real difference is that there is some unnecessary work in option two; in the first line I am not 100% on this explanation, so I welcome someone with a deep understanding.

- Flech

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -