JTable table = new JTable(); table.setValueAt("Hello World", 0, 0);
DefaultTableModel model = new DefaultTableModel(new String[]{"Name", "Age", "Gender"}, 0); JTable table = new JTable(model); table.setValueAt("John", 0, 0); table.setValueAt(25, 0, 1); table.setValueAt("Male", 0, 2);This code creates a new JTable instance with a DefaultTableModel instance containing headers for "Name", "Age", and "Gender". The JTable instance is then populated with values in the first row using the setValueAt method. This method belongs to the javax.swing package library.