Arrays constants can only be used in initializers error

前端 未结 5 1878
谎友^
谎友^ 2020-11-30 10:19

Consider:

public proj 3 {

    static string [][]Item;

    public static void main(String [] args){

        Item[][] = {
             {\"BH,\" , \"Backhoe,         


        
5条回答
  •  日久生厌
    2020-11-30 11:16

    You have two options: In the declaration

    private static String[][] item = {...};

    OR

    Elsewhere using the new keyword private static String[][] item = new String[][]{...}

    Also, you'll need to change public proj to public class

提交回复
热议问题