// create a new JTable object JTable table = new JTable(data, columnNames); // get the value at row 2 and column 3 Object value = table.getValueAt(2, 3);
// iterate over all rows and columns in a JTable for (int i = 0; i < table.getRowCount(); i++) { for (int j = 0; j < table.getColumnCount(); j++) { // get the value at this row and column Object value = table.getValueAt(i, j); } }In this example, we use a nested for loop to iterate over all rows and columns in a JTable. For each cell, we use the getValueAt method to retrieve the value.