gpt4 book ai didi

java - 在内部类中实现接口(interface)

转载 作者:行者123 更新时间:2023-12-01 23:39:06 26 4
gpt4 key购买 nike

我只是想知道如何在内部类中实现接口(interface)。我必须创建一个名为 tConvertMethods 的接口(interface),然后在内部类中实现它。

You will be doing the event-handling operations using an inner class, have the inner class implement tConvertMethods interface as well as having it implement ActionListener inferface.

最佳答案

您可以在 Java 中实现多个接口(interface)。

如果 ButtonHandler 是您的内部类。

private class ButtonHandler implements ActionListener, tConvertMethods{
// Your code here

}

Go through this.

关于java - 在内部类中实现接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18221423/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com