Hello, i'm having issues trying to sort out a multidimensional array for a JTable. However, before i pass my array to a JTable, i'd like to work out how to set it up properly and then System.out.println it on the command line so i can have a rough idea what the table will look like. Here's the code i've been playing with.
1. To set up the array (assuming colum size will always be 3, whilst row size depending on whatever database returns):
isn't valdid syntax. I assume you're really saying "data[row].length".
Second, if you want all the entries for a row to be on the same line, you should not use "println" to print them, but rather "print". You're already printing a tab after each item, so they'll be separated on the page.
And finally, as shown, the loop to fill the array (which I recognize as an example I showed you or someone else earlier this week) would put the same data into each row of the array; you need more code in that loop to set new values for those variables each time around, right? Otherwise you'd see exactly what you're seeing: repeated data.