标签: java multithreading static
我想知道以下代码是否正常:
public class MyClass { ... static { new MyClass().start(); } private void start() { //running the thread } }
我必须补充一点,我无法访问类似main方法的内容,因为这部分代码是从外部调用的。
是否存在更复杂的启动此线程的方法?