Do interfaces solve the “deadly diamond of death” issue?

后端 未结 6 735
长情又很酷
长情又很酷 2021-01-03 03:02

Do interfaces solve the deadly diamond of death problem?

I don\'t think so, for example:

// A class implementing two interfaces Interface1 and Interf         


        
6条回答
  •  青春惊慌失措
    2021-01-03 03:17

    No, you don't. Interfaces don't have any variables, other than static final ones.

    If you actually write, compile, and execute those interfaces and classes you'll have your answer. That x variable is not a class member, so there's no ambiguity.

    This is one of those questions that you can easily answer for yourself by writing the code and letting the JDK tell you. It'll be faster than asking here.

提交回复
热议问题