java - 找不到符号 - 类Arraylist

时间:2022-04-06 15:20:18

I keep getting the following error with my arraylist. Any help is appreciated

我的arraylist一直出现以下错误。任何帮助表示赞赏

cannot find symbol - Class Arraylist

找不到符号 - 类Arraylist

public class Bank
{
    private ArrayList<Account> accounts;


    /**
     * A bank starts without any accounts.
     */
    public Bank()
    {
    accounts = new Arraylist<Account>();
    }

4 个解决方案

#1


12  

You need to add import declarations on class file header.

您需要在类文件头上添加导入声明。

ArrayList is member of java.util package.

ArrayList是java.util包的成员。

And, remember that Java is a case sensitive language. ArrayList is different from Arraylist

并且,请记住Java是一种区分大小写的语言。 ArrayList与Arraylist不同

You should declare like following:

你应该声明如下:

import java.util.ArrayList;

class Bank{
/*class content*/
}

#2


11  

capitalize the L in ArrayList.

在ArrayList中大写L。

#3


4  

It's ArrayList, not Arraylist. Case matters.

它是ArrayList,而不是Arraylist。案件很重要。

#4


4  

Java is case-sensitive. I think the problem is in this line:

Java区分大小写。我认为问题出在这一行:

accounts = new Arraylist();

accounts = new Arraylist();

It's "ArrayList" not Arraylist.

它的“ArrayList”不是Arraylist。

I hope to have been helpfull.

我希望能有所帮助。

#1


12  

You need to add import declarations on class file header.

您需要在类文件头上添加导入声明。

ArrayList is member of java.util package.

ArrayList是java.util包的成员。

And, remember that Java is a case sensitive language. ArrayList is different from Arraylist

并且,请记住Java是一种区分大小写的语言。 ArrayList与Arraylist不同

You should declare like following:

你应该声明如下:

import java.util.ArrayList;

class Bank{
/*class content*/
}

#2


11  

capitalize the L in ArrayList.

在ArrayList中大写L。

#3


4  

It's ArrayList, not Arraylist. Case matters.

它是ArrayList,而不是Arraylist。案件很重要。

#4


4  

Java is case-sensitive. I think the problem is in this line:

Java区分大小写。我认为问题出在这一行:

accounts = new Arraylist();

accounts = new Arraylist();

It's "ArrayList" not Arraylist.

它的“ArrayList”不是Arraylist。

I hope to have been helpfull.

我希望能有所帮助。