Java中的抽象类错误 [英] Abstract Class Error in Java

查看:33
本文介绍了Java中的抽象类错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Java 新手,遇到了一个我无法弄清楚的编译错误.

I'm new to Java and I'm running into a compile error I cannot figure out.

Chapter5Debug is not abstract and does not override abstract method itemStateChanged(java.awt.event.ItemEvent) in java.awt.event.ItemListener

public class Chapter5Debug extends Frame implements ItemListener
       ^

谁能帮助我了解我需要做些什么来解决这个问题?

Can anyone help me understand what I need to do to fix this?

感谢您的帮助!

希拉

推荐答案

你必须记住,如果 ItemListener 是抽象的,那么你将需要实现 ItemListener 中的所有方法.如果您想保留当前的结构,您只需在 Chapter5Debug 类中添加一个空的 itemStateChanged 方法即可.

You have to remember that if ItemListener is abstract, then you will need to implement all the methods inside ItemListener. If you want to keep your current structure, you can just add an empty itemStateChanged method to your Chapter5Debug class.

这篇关于Java中的抽象类错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆