Why use method local abstract inner classes

后端 未结 10 1763
名媛妹妹
名媛妹妹 2021-02-05 04:45

One of the legal modifiers you can use with method local inner classes is abstract.

For example:

public class Outer {
    public void method(){
        a         


        
10条回答
  •  鱼传尺愫
    2021-02-05 05:28

    No, there is no good use for abstract classes (or classes in general) inside methods.

    It would only make sense if only that particular method would need that particular class and would also implement it. Actually having that situation maybe happens once in trillions of methods you write.

提交回复
热议问题