读书人

为什么下面的程序说小弟我quot;keysTocutB

发布时间: 2012-04-12 15:46:35 作者: rapoo

为什么下面的程序说我"keysTocutBysections = {{}}"非法表达式开始
为什么下面的程序说我"keysTocutBysections = {{}}"非法表达式开始?


public class GetAllContent {
String address;
String[][] keysTocutBysections;
public String GetAllCont (String addr, String keyword) {
address = addr;
if (address.indexOf("9") != -1) {
keysTocutBysections = {{}};
}
return "0";
}
public static void main(String[] args) {
GetAllContent xx = new GetAllContent();
xx.GetAllCont("99", "0");

}
}

[解决办法]
哦 不好意思 刚才没细心看 这个应该是数组静态初始化的时候 应该在声明数组的时候同时进行初始化

Java code
String address;   public String GetAllCont (String addr, String keyword) {  address = addr;  if (address.indexOf("9") != -1) {  String[][]  keysTocutBysections = {{}};  }  return "0";  }  public static void main(String[] args) {  GetAllContent xx = new GetAllContent();  xx.GetAllCont("99", "0");      } 

读书人网 >J2SE开发

热点推荐