使用VectorEnumerator类 [英] Using VectorEnumerator Class
问题描述
我在网页上找到了这个例子
Enumeration enum = v.elements();
while(enum.hasMoreElements())
{
String elemento =(String)enum.nextElement();
if(elemento.equals(" tres"))
{
System.out.println(" Encontrado tres");
休息;
}
}
但是当我粘贴到我的代码并执行它时抛出这个例子
java.lang.ClassCastException:java。 util.Vector
在Layout2.documentLines(Layout2.java:282)
在Layout2.obtieneCadena(Layout2.java:200)
at Layout2.generaDocumento(Layout2.java:78)
在LanzaLayout.main(LanzaLayout.java:241)
线程中的异常main
请帮助
我在网上找到了这个例子页面
枚举枚举= v.elements();
while(enum.hasMoreElements())
{
String elemento =(String)enum.nextElement();
if(elemento.equals(" tres"))
{
System.out.println(" Encontrado tres");
休息;
}
}
但是当我粘贴到我的代码并执行它时抛出这个例子
java.lang.ClassCastException:java.util.Vector
在Layout2.documentLines(Layout2.java:282)
在Layout2.obtieneCadena(Layout2.java:200)
在Layout2.generaDocumento(Layout2.java:78)
在LanzaLayout.main(LanzaLayout.java:241)
线程中的异常main
请帮助
你在载体中有什么类型的元素?
< blockquote>
你在向量中有哪些类型的元素?
我在主矢量中有向量
我有里面的向量主要向量
那么就没有
展开 | / span> 选择 | 换行 | 行号
I found this example on a web page
Enumeration enum=v.elements();
while(enum.hasMoreElements())
{
String elemento=(String)enum.nextElement();
if(elemento.equals("tres"))
{
System.out.println("Encontrado tres");
break;
}
}
but when i paste into my code and execute it throws this exeption
java.lang.ClassCastException: java.util.Vector
at Layout2.documentLines(Layout2.java:282)
at Layout2.obtieneCadena(Layout2.java:200)
at Layout2.generaDocumento(Layout2.java:78)
at LanzaLayout.main(LanzaLayout.java:241)
Exception in thread "main"
Please help解决方案I found this example on a web page
Enumeration enum=v.elements();
while(enum.hasMoreElements())
{
String elemento=(String)enum.nextElement();
if(elemento.equals("tres"))
{
System.out.println("Encontrado tres");
break;
}
}
but when i paste into my code and execute it throws this exeption
java.lang.ClassCastException: java.util.Vector
at Layout2.documentLines(Layout2.java:282)
at Layout2.obtieneCadena(Layout2.java:200)
at Layout2.generaDocumento(Layout2.java:78)
at LanzaLayout.main(LanzaLayout.java:241)
Exception in thread "main"
Please helpWhat type of elements do you have in the vector?
What type of elements do you have in the vector?I have vectors inside the main vector
I have vectors inside the main vectorWell then doesn''t
Expand|Select|Wrap|Line Numbers
这篇关于使用VectorEnumerator类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文