Why is Thread.run() declared public? Shouldn't it be declared protected, as only the Thread superclass can invoke it?
Created May 4, 2012
Alex Chaffee One reason is that Thread implements Runnable, which requires that
run()
be public. This is an unfortunate consequence of the definition of Java interfaces.
It is also not clear whether you would want to prohibit other classes from calling a Thread's
But you're right, it feels wrong. :-) run()
method in a synchronous manner -- as it is, they have the option of calling either run()
or start()
depending on their needs.