Reduce visibility when implementing interface in Java

后端 未结 4 1347
误落风尘
误落风尘 2021-01-11 18:12

I would like to design class A implements interface C and reduce the visibility of a method (declared in C)to make it secure from outer world, make one of the methods in in

4条回答
  •  礼貌的吻别
    2021-01-11 18:22

    You can't reduce the visibility of the method of an interface in Java. Is it acceptable for you to implement the method by throwing a java.lang.UnsupportedOperationException?

提交回复
热议问题