下面是我写的一段代码:编译时出错,无法解析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();
}
}
}
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();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货