开发者

java - cannot find symbol - Class Arraylist

I 开发者_如何学Ckeep 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*/
}


capitalize the L in ArrayList.


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.


Please add the line import java.util.* in header.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜