overriding methods without subclassing in Java

前端 未结 5 1946
时光取名叫无心
时光取名叫无心 2021-01-02 05:41

I started on a new project recently and saw the usage of overriding like below for the first time.

public class SomeClass {
  public void myMethod() {
    XS         


        
5条回答
  •  执念已碎
    2021-01-02 06:08

    Search Google for Anonymous Inner Class in Java

    That's pretty useful to implement interfaces or abstract Class methods on concrete objects

    That's heavily used when working with threading (Runnable class)

提交回复
热议问题