'('或'['预期

Chr*_*ris 5 java arrays

我在尝试编译程序时遇到以下错误.

'('或'['预期.

 public AccountArrayList()
{
    // line one below is the hi-lighted code
    ArrayList accounts = new ArrayList;
    accounts.add("1");
    accounts.add("1");
    accounts.add("1");
    accounts.add("1");
    accounts.add("1");
    accounts.add("1");
    accounts.add("1");
    accounts.add("1");
    accounts.add(5,"900");
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

Yuv*_*dam 12

你在构造函数上缺少括号:

ArrayList accounts = new ArrayList();
Run Code Online (Sandbox Code Playgroud)