Can You Write an Interface that Can Not be implemented?

前端 未结 3 1369
后悔当初
后悔当初 2021-01-13 21:32

This is related to final interface in java. Among the discussion there was that the concept of final in relation to interfaces is ambiguous. Would a final interface mean t

3条回答
  •  不知归路
    2021-01-13 22:25

    I submit the following as an interface such that implementation will be prevented at compile-time.

    interface FinalInterface
    {
        class Types
        {
            private class Alpha { }
    
            private class Beta { }
        }
    
        void method ( Types . Alpha param ) ;
    
        void method ( Types . Beta param ) ;
    }
    

提交回复
热议问题