100分求教:Form不能实现ItemStateListener??
有一个类,继承了Form,实现了CommandListener, ItemStateListener,定义如下:
====================================================
public class TestUI extends Form implements CommandListener,ItemStateListener {}
====================================================
但是,在覆写ItemStateListener的方法itemStateChanged(Item item)的时候,Eclipse总是有一个警告:
===================================================
Multiple markers at this line
- The method TestUI.itemStateChanged(Item) does not override the inherited method from Displayable since it is private to a different package.
- implements javax.microedition.lcdui.ItemStateListener.itemStateChanged
===================================================
如果是一个MIDlet,实现接口CommandListener, ItemStateListener的时候不会出现上面这个警告。
哪位大虾指点指点这个警告是什么意思么?
------解决方案--------------------反编译之后,发现Displayable类里有一个 void itemStateChanged(Item)方法
如果你再实现ItemStateListener接口,2个方法名重复了,会造成运行结果异常的
------解决方案--------------------The method TestUI.itemStateChanged(Item) does not override the inherited method from Displayable since it is private to a different package.
很明显,私有的不同包的继承方法不能被覆写!