can someone explain to me what
new Object[]{test_name,test_laenge};
means? will it just create a new one dimensional Object with 2 tuple values test_name and test_laenge?
I used this in this construction to extract values from a Database into a resultset and insert those value-tuples into a 2-column JTable...
((DefaultTableModel)table.getModel()).addRow(new Object[]{test_name,test_laenge});
but I dont really understand how this works...
It creates an array of size two, where the entries in the array are test_name and test_laenge
It is the same as:
Object[] array = new Object[2];
array[0] = test_name;
array[1] = test_laenge;
((DefaultTableModel)table.getModel()).addRow(array);
The entries in the array is treated as columns and adds one row in the database.
new Object[]{test_name,test_laenge};
creates a new array (Object[]) with two elements: test_name and test_laenge.
The actual elements are the objects referenced by the two variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With