当前位置: 技术问答>java相关
我是菜鸟,请帮助我。编译JAVA程序时,“e.hasMore Elements()”出错,不明白!
来源: 互联网 发布时间:2015-07-18
本文导语: C:>javac DriverManagerTest.java DriverManagerTest.java:16: ';' expected for(Enumeration e=DriverManager.getDrivers(); e.hasMore El ements();) ...
C:>javac DriverManagerTest.java
DriverManagerTest.java:16: ';' expected
for(Enumeration e=DriverManager.getDrivers(); e.hasMore El
ements();)
^
DriverManagerTest.java:16: cannot resolve symbol
symbol : variable hasMore
location: interface java.util.Enumeration
for(Enumeration e=DriverManager.getDrivers(); e.hasMore El
ements();)
^
2 errors
我在“e.hasMore Elements()”中加了一个“.”,再一次编译,提示信息如下:
DriverManagerTest.java:16: cannot resolve symbol
symbol : variable hasMore
location: interface java.util.Enumeration
for(Enumeration e=DriverManager.getDrivers(); e.hasMore.El
ements();)
^
1 error
DriverManagerTest.java:16: ';' expected
for(Enumeration e=DriverManager.getDrivers(); e.hasMore El
ements();)
^
DriverManagerTest.java:16: cannot resolve symbol
symbol : variable hasMore
location: interface java.util.Enumeration
for(Enumeration e=DriverManager.getDrivers(); e.hasMore El
ements();)
^
2 errors
我在“e.hasMore Elements()”中加了一个“.”,再一次编译,提示信息如下:
DriverManagerTest.java:16: cannot resolve symbol
symbol : variable hasMore
location: interface java.util.Enumeration
for(Enumeration e=DriverManager.getDrivers(); e.hasMore.El
ements();)
^
1 error
|
e.hasMore Elements()中间不要有空格
应该是:
e.hasMoreElements()
应该是:
e.hasMoreElements()
|
set classpath=.;%classpath%;
你也可以java -cp . DriverManagerTest
你也可以java -cp . DriverManagerTest