The JTable class is used to display data in tabular form. It is composed of rows and columns.
Let's see the declaration for javax.swing.JTable class.
| Constructor | Description |
|---|---|
| JTable() | Creates a table with empty cells. |
| JTable(Object[][] rows, Object[] columns) | Creates a table with the specified data. |
Output:

Output:

If you select an element in column NAME, name of the element will be displayed on the console:
We request you to subscribe our newsletter for upcoming updates.