日期:2014-05-20  浏览次数:20723 次

Enumeration该怎样用?
public   void   buildFileDirectory(String   path)
{
Enumeration   enum=null;
FileConnection   fc=null;
try
{
fc=(FileConnection)Connector.open   ( "file:// "+path);
enum=fc.list();
listDirectory.deleteAll();
//listDirectory.append(   ".. ",null);
while(enum.hasMoreElements())
{
String   name=(String)enum.nextElement();
listDirectory.append(   name,null);
}
fc.close()   ;
}
catch(IOException   e)
{}
}

我的MIDlet程序里面有这样一段代码,但是有警告: 'enum '   should   not   be   used   as   an   identifier,since   it   is   a   reserved   keyword   from   source   level   5.0   on.....

请问该怎样修改??请大家指教!!!



------解决方案--------------------
这个应该是告诉你,enum在jdk1.5就不让作为变量名了
不知道说的对不对
------解决方案--------------------
楼上说的没错,在5.0以后enum是关键字了
------解决方案--------------------
改了名以后什么错误,发出来看看~~
------解决方案--------------------
1.5之后 enmu变成关键字拉 是不能用做变量名的拉
------解决方案--------------------
搞技术,基本的英文术语还是要看懂吧
象这些问题,有IDE的帮助,根本不是什么问题