public static void main( String[] args ) throws Exception {
     String[] msgs = new String[3];
        if( args[2].equals("MONGOLIA") ) {
                //这段错误,说是必须初始话的时候才能这样写,那样就只能msgs[0]="123";msgs[1]="234";msgs[2]="345";这样写了吗
     msgs = { Constant.MSG_MONGOLIA,Constant.MSG_MONGOLIA,Constant.MSG_MONGOLIA };

        }
        else return;}

解决方案 »

  1.   

    数组常量只能在初始化的时候用String[] msgs ={ Constant.MSG_MONGOLIA,Constant.MSG_MONGOLIA,Constant.MSG_MONGOLIA }; 
    初始化后就像你说的那样,给数组元素赋值
      

  2.   

    也可以
    这样初始化!
    String[] msgs = new String[3]; 
    msgs[0] = "aaaaaaaaa";
    msgs[1] = "bbbbbbbbb";
    msgs[2] = "ccccccccc";
      

  3.   

    String[] msgs = new String[]{ Constant.MSG_MONGOLIA,Constant.MSG_MONGOLIA,Constant.MSG_MONGOLIA };
    或是
    String[] msgs = new String[3];
    msgs[0] = "a";
    msgs[1] = "b";
    msgs[2] = "c";