预期为“(”或“ [” [英] '(' or '[' Expected

查看:80
本文介绍了预期为“(”或“ [”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试编译程序时出现以下错误。

I am getting the following error when trying to compile my program.

'('或'['预期。

 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");
}

谢谢。

推荐答案

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

You're missing parenthesis on the constructor:

ArrayList accounts = new ArrayList();

这篇关于预期为“(”或“ [”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆