Topic: Enumeration 无法解析,请教各位

  Print this page

1.Enumeration 无法解析,请教各位 Copy to clipboard
Posted by: suprahan
Posted on: 2008-06-15 16:26

下面是一段代码,编译时候提示无法解析enumeration ,请教这是为什么?查找过很多方面都没有查到


import java.util.*;
import java.io.*;
class PropTest
{
public static void main(String[] args)
{
/*Properties pro=System.getProperties();
pro.list(System.out);*/
Properties pro=new Properties();
try{
pro.load(new FileInputStream("winsun.ini"));
Enumeration enum=pro.propertyNames();
while(enum.hasMoreElements())
{
String strKey=(String)enum.nextElement();
String strValue=pro.getProperty(strKey);


System.out.println(strKey+strValue);


}

}

catch(Exception e)
{
e.printStackTrace();

}

}
}

2.Re:Enumeration 无法解析,请教各位 [Re: suprahan] Copy to clipboard
Posted by: JiafanZhou
Posted on: 2008-06-16 15:47

enum is a keyword in the JAVA and should not be used as identifier. Try to use a different should solve your issue here.

Cheers,
Jiafan

3.Re:Enumeration 无法解析,请教各位 [Re: suprahan] Copy to clipboard
Posted by: suprahan
Posted on: 2008-06-19 17:41

thanks ,from what you said ,I can guess that you are excellent,especially in java.

4.Re:Enumeration 无法解析,请教各位 [Re: suprahan] Copy to clipboard
Posted by: JiafanZhou
Posted on: 2008-06-20 18:27

Ok, suprahan. But you should use/know the Java compiler to find the comping errors yourself.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923