简体   繁体   中英

java - cannot find symbol - Class Arraylist

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

cannot find symbol - Class Arraylist

public class Bank
{
    private ArrayList<Account> accounts;


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

You need to add import declarations on class file header.

ArrayList is member of java.util package.

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

You should declare like following:

import java.util.ArrayList;

class Bank{
/*class content*/
}

将 ArrayList 中的 L 大写。

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

accounts = new Arraylist();

It's "ArrayList" not Arraylist.

I hope to have been helpfull.

It's ArrayList , not Arraylist . Case matters.

请在标题import java.util.*添加import java.util.*行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM