Implement an interface and override methods in Java?

后端 未结 6 1011
旧巷少年郎
旧巷少年郎 2021-01-24 16:14

Why do you have to override all methods of an interface?

For instance if I have

public class Foo extend JFrame implements ActionListener, KeyListener {
          


        
6条回答
  •  梦谈多话
    2021-01-24 16:22

    You really should grab a good book about object orientated programming and revisit the first chapters. An interface is a completely abstract definition of methods, so you cannot implement an interface partially.

提交回复
热议问题