你这是什么程序?
本身就是错的 ------------------------------------------------------
           我们还年轻牛奶会有的奶牛也会有的 
             可天天在 csdn 混这些会有吗 ??

解决方案 »

  1.   

    程序如下:String[] col= new String[30]; for(int i=0; i<col.length; i++) { 

    col = forlocation(); private String forlocation() { String[] locations = { "Where ", "How " }; } 报错提示是这样:incompatible types
    found   : java.lang.String
    required: java.lang.String[]
    col = forlocation(); 不知该如何解决?
      

  2.   

    程序如下:(主要的都在了)String[] col= new String[30]; for(int i=0; i<col.length; i++) { 

    col = forlocation(); private String forlocation() { String[] locations = { "Where ", "How " }; .....................} 报错提示是这样:incompatible types
    found   : java.lang.String
    required: java.lang.String[]
    col = forlocation(); 不知该如何解决?
      

  3.   

    String[] col= new String[30]; for(int i=0; i<col.length; i++) 


    col = forlocation(); }
    private String forlocation() { String[] locations = { "Where ", "How " }; 
    return locations[0];} 
    这才勉强通得过,但不知道你想做什么。
      

  4.   

    String[] col= new String[30]; for(int i=0; i<col.length; i++) 


    col = forlocation(); }
    .....................
    //另一个方法
    private String forlocation() { String[] locations = { "Where ", "How " }; 
    return locations[0];} 
      

  5.   

    String[] col= new String[30]; for(int i=0; i<col.length; i++) { 

    col = forlocation(); private String[] forlocation() { String[] locations = { "Where ", "How " }; 
    return locations;
    }
      

  6.   

    我是想将 forlocation()类中的数组的值, 赋给到col中去
      

  7.   

    String[] col= new String[30]; 
    col = forlocation(); private String[] forlocation() { String[] locations = { "Where ", "How " }; 
    return locations;
    }这样 ------------------------------------------------------
               我们还年轻牛奶会有的奶牛也会有的 
                 可天天在 csdn 混这些会有吗 ??
      

  8.   

    String[] col= new String[30]; 

    col = forlocation(); private String[] forlocation() { String[] locations = { "Where ", "How " }; String[] actions = { " for ", " find ", " get " };......................String[][] sentence = 
    { locations, actions, sources, 
    prepositions, subjects, endings }; 
    }还是不行嘛
      

  9.   

    *************  String[] col= new String[30]; 
    数组col可不指定长度,如方法forlocation返回数组长度大于30,程序肯定的死翘翘。
    String[] col;
    col = forlocation(); private String[] forlocation() { 
    String[] locations = { "Where ", "How " }; 
    return locations;
    }
      

  10.   

    先不管你的功能问题了,你的forlocation()返回的是一个String,你的col是一个String[]啊,当然不匹配了,你想返回一个字符串数组的话,你的函数返回值就要说清楚啊
    String[] col= new String[30]; for(int i=0; i<col.length; i++) { 

    col = forlocation(); private String[] forlocation() { 
              ~~~~~~~~String[] locations = { "Where ", "How " }; .....................} 
      

  11.   

    报错是这样的:incompatible types
    found   : java.lang.String
    required: java.lang.String[]
    col = forlocation(); 
    String[] col;
    col = forlocation(); private String[] forlocation() { 
    String[] locations = { "Where ", "How " }; 
    return locations;String[][] sentence = 
    { locations, actions, sources, 
    prepositions, subjects, endings }; 
    }
    return sentence.length;
    }
      

  12.   

    我想返回sentence 的长度 定义后的值,是这样String[] col= new String[30]; 
    col = forlocation(); 
    private String[] forlocation() { 
    String[] locations = { "Where ", "How " }; 
    String[] actions = { " for ", " find ", " get " };......................String[][] sentence = 
    { locations, actions, sources, 
    prepositions, subjects, endings }; 
    for(int i=0; i<sentence.length; i++) { 
    query = query + randomEntry(sentence); 

    return(query); 
    }
    private String randomEntry(String[] strings) { 
    int index = (int)(Math.random()*strings.length); 
    return(strings[index]);