当前位置: 代码迷 >> J2SE >> 为什么下面的程序说小弟我"keysTocutBysections = {{}}"非法表达式开始
  详细解决方案

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

热度:53   发布时间:2016-04-24 01:25:51.0
为什么下面的程序说我"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");      }
  相关解决方案