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.
加载中,请稍侯......
精彩评论