首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

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

2012-04-12 
为什么下面的程序说我keysTocutBysections {{}}非法表达式开始为什么下面的程序说我keysTocutBysecti

为什么下面的程序说我"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");      } 

热点排行