java - Array result into an array -


i trying put results of array new object array cant seem work out how.

i first create chessboard array 10*10 , put word hello elements.

i create loop go through elements create 10*10 matrix of array holds, in case "hello". output called result1

i want put elements of result1 object array called rowdata[][]. array of go into jtable

jtable table = new jtable(rowdata, columnnames);  string [][] chessboard = new string[10][10]; (int row = 0;row<=9;row++){     (int col = 0; col <=9; col++){         chessboard[row][col] = "hello";     } }  string result1 = ""; (int row1 = 0;row1<=9;row1++){     (int col2 = 0; col2 <=9; col2++){         result1 += chessboard[row1][col2];     }     result1 += "\r\n"; } system.out.format(result1);  object rowdata[][] = {the result1 each element of new object array};  

you can pass string array -- no need new object[][]:

jtable table = new jtable(chessboard, columnnames); 

an array of strings array of objects. see this relevant article covariance in java arrays.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -