Closed. This question is not reproducible or was caused by typos。它当前不接受答案。
                            
                        
                    
                
            
                    
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        2年前关闭。
                    
                
        

我想制作2d数组并稍后解析:

String[][] position  = new String[3][3];
    position = [{id:10, x:10, y:20}, {id:5, x:30, y:40}, {id:2, x:2, y:7},];




String[][] position  = [
    {id:10, x:10, y:20},
    {id:5, x:30, y:40},
    {id:2, x:2, y:7},
    ];


但是这两个接缝都不起作用。

关于我在做什么错的任何建议?

最佳答案

First String不是int,String应该在""之间,您的赋值应该像这样:

String[][] position  =
                 {{"id:10", "x:10", "y:20"}, {"id:5", "x:30", "y:40"}, {"2", "2", "7"}};


如果您的意思是int数组,则您的数组应如下所示:

int[][] position  = {{10, 10, 20}, {5, 30, 40}, {2, 2, 7}};

09-10 07:52
查看更多