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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.