Passing code as function arguments

后端 未结 6 1589
星月不相逢
星月不相逢 2021-01-23 22:56

I was reading a textbook and I was wondering how come the argument we pass to the function is neither a primitive or an user-defined instance of a class.

SwingU         


        
6条回答
  •  时光取名叫无心
    2021-01-23 23:08

    This is actually passing an instance of an anonymous inner class implementing the Runnable interface. Read about them in the Java tutorial.

提交回复
热议问题