<%   String twea = "";
   String weatherinfo[] = new String [35];   weatherinfo[] = ['54511','58367','54517','45005','54857','54449','54342','57516','45011','50953','58968','54823','53698','57036','53772','52889','58457','58321','57816','59758','56778','58847','58606','52866','58238','57494','55591','53614','57687','51463','57083','59432','54161','56294'];
  
   for (int w=0;w<35;w++)
   {
   weatherinfo[w]="haha"+weatherinfo[w];
   twea = twea+weatherinfo[w];
   }out.print(twea);
%>报错信息是Syntax error on tokens, delete these tokens

解决方案 »

  1.   

     我改成下面这样,报错更多~
      weatherinfo[] = {"54511","58367","54517","45005","54857","54449","54342","57516","45011","50953","58968","54823","53698","57036","53772","52889","58457","58321","57816","59758","56778","58847","58606","52866","58238","57494","55591","53614","57687","51463","57083","59432","54161","56294"};
    错误信息:
    Syntax error on token "]", VariableDeclaratorId expected after this tokenweatherinfo cannot be resolved to a type
      

  2.   

    weatherinfo[] = {"...","...",.....};
      

  3.   

    哦错了,
    String[] weatherinfo = new String [35];
    weatherinfo = {"...","...",.....};
      

  4.   

    String weatherinfo[] = {'54511','58367','54517','45005','54857','54449','54342'......};
      

  5.   

    Array constants can only be used in initializers
      

  6.   

     但是他new了35大小的数组可是只赋了34个值...
      

  7.   


     String twea = "";
    String weatherinfo[] = {"54511", "58367", "54517", "45005", "54857", "54449", "54342", "57516", "45011", "50953", "58968", "54823", "53698", "57036", "53772", "52889", "58457", "58321", "57816", "59758", "56778", "58847", "58606", "52866", "58238", "57494", "55591", "53614", "57687", "51463", "57083", "59432", "54161", "56294"};        for (int w = 0; w < weatherinfo.length; w++) {
                weatherinfo[w] = "haha" + weatherinfo[w];
                twea = twea + weatherinfo[w];
            }