//原代码,最后错误提示找不到符号,请帮忙指正错误
import java.util.*;
public class UseEnumeration
{
public static void main (String args[])
{
Vector vScore = new Vector ();
vScore.add ("86");
vScore.add ("98");
vScore.add (1, "99");
System.out.println ("Vector:" + vScore.toString ());
for (Enumeration e = vScore.elements ();e.hasMoreElements ();)
{
System.out.println (e.nextElements ());
}
Hashtable hScore = new Hashtable ();
hScore.put ("张一", 86);
hScore.put ("李二", 98);
hScore.put ("海飞", 99);
System.out.println ("Hashtable:" + hScore.toString ());
for (Enumeration e = hScore.keys ();e.hasMoreElements ();)
{
String str = (String)e.nextElements ();
System.out.println (str + ":");
System.out.println (hScore.get (str));
}
}
错误:
未找到符号
System.out.println (e.nextElements ());
^
String str = (String)e.nextElements ();
^
import java.util.*;
public class UseEnumeration
{
public static void main (String args[])
{
Vector vScore = new Vector ();
vScore.add ("86");
vScore.add ("98");
vScore.add (1, "99");
System.out.println ("Vector:" + vScore.toString ());
for (Enumeration e = vScore.elements ();e.hasMoreElements ();)
{
System.out.println (e.nextElements ());
}
Hashtable hScore = new Hashtable ();
hScore.put ("张一", 86);
hScore.put ("李二", 98);
hScore.put ("海飞", 99);
System.out.println ("Hashtable:" + hScore.toString ());
for (Enumeration e = hScore.keys ();e.hasMoreElements ();)
{
String str = (String)e.nextElements ();
System.out.println (str + ":");
System.out.println (hScore.get (str));
}
}
错误:
未找到符号
System.out.println (e.nextElements ());
^
String str = (String)e.nextElements ();
^
public static void main(String args[]) {
Vector vScore = new Vector();
vScore.add("86");
vScore.add("98");
vScore.add(1, "99");
System.out.println("Vector:" + vScore.toString());
for (Enumeration e = vScore.elements(); e.hasMoreElements();) {
System.out.println(e.nextElement());
}
Hashtable hScore = new Hashtable();
hScore.put("张一", 86);
hScore.put("李二", 98);
hScore.put("海飞", 99);
System.out.println("Hashtable:" + hScore.toString());
for (Enumeration e = hScore.keys(); e.hasMoreElements();) {
String str = (String) e.nextElement();
System.out.println(str + ":");
System.out.println(hScore.get(str));
}
}
}你就是方法名错了没有s
改成System.out.println(e.nextElement());
我是初学者,各位见笑了,请问你们一般用什么ide