How to start anonymous thread class

前端 未结 8 750
清歌不尽
清歌不尽 2020-12-04 15:37

I have the following code snippet:

public class A {
    public static void main(String[] arg) {
        new Thread() {
            public void run() {
               


        
8条回答
  •  伪装坚强ぢ
    2020-12-04 15:43

    Leaving this here for future reference, but its an answer too.

    new Thread(() -> whatever()).start();

提交回复
热议问题