ArrayList的方法不工作 [英] ArrayList methods are not working
本文介绍了ArrayList的方法不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我学习Java和我被困在这个的ArrayList
的问题:编译器给我的错误,当我尝试用简单的方法,如添加
。这里是code:
I am learning about Java and I'm stuck with this ArrayList
problem: the compiler give me error when I try to use simple methods, like add
. Here is the code:
public class ArrayList {
public static void main(String[] args) {
ArrayList list = new ArrayList();
list.add("Value A");
list.add("Value B");
list.add("Value C");
}
}
该方法在的的Javadoc 。
这应该是非常简单的做,但我真的不知道我在做什么错在这里。
It should be really simple to do it, but I really don't know what I'm doing wrong here.
推荐答案
您已经创建了自己的的ArrayList
类,并没有使用的built-in Java类。您还没有定义添加
。
You have created your own ArrayList
class and aren't using the built-in Java class. You haven't defined add
.
这篇关于ArrayList的方法不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文