The default implementation of java.lang.Thread
's run
will only perform a task passed as a Runnable
. If no
Runnable
has been provided at construction time, then the thread will not perform any action.
When extending java.lang.Thread
, you should override the run
method or pass a Runnable
target to the
constructor of java.lang.Thread
.
Noncompliant code example
public class MyThread extends Thread { // Noncompliant
public void doSomething() {
System.out.println("Hello, World!");
}
}