DEV Community

Discussion on: TIL: Two Ways to Create Java Threads

Collapse
 
curtisfenner profile image
Curtis Fenner

Starting a thread in a constructor is questionable to me. A Runnable is something to be run (it's in the name), not something that should immediately launch itself uncontrollably upon creation.

As a nice variant of the first method, you can use lambdas so that you don't even need a class definition.