import javax.swing.*; import javax.swing.table.*; import java.awt.*; class Table{ public static void main(String args[]){ JFrame frame = new JFrame(); String[] columnNames = {"Name", "Age", "Student"}; Object[][] data = { {"Ken", new Integer(5), new Boolean(false)}, {"Tom", new Integer(3), new Boolean(true)}, {"Susam", new Integer(2), new Boolean(false)}, {"Mark",new Integer(20), new Boolean(true)}, {"Joe", new Integer(10), new Boolean(false)} }; JTable table = new JTable(data, columnNames); frame.add(table); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400,400); frame.setLocationRelativeTo(null); frame.setVisible(true); } }import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class TestApplication { static final String DB_URL = "jdbc:mysql://localhost/YOUR_DB_NAME"; static final String USER = "guest"; static final String PASS = "guest123"; public static void main(String[] args) { // Open a connection try(Connection conn = DriverManager.getConnection(DB_URL, USER, PASS); Statement stmt = conn.createStatement(); ) { String sql = "CREATE TABLE REGISTRATION " + "(id INTEGER not NULL, " + " first VARCHAR(255), " + " last VARCHAR(255), " + " age INTEGER, " + " PRIMARY KEY ( id ))"; stmt.executeUpdate(sql); System.out.println("Created table in given database..."); } catch (SQLException e) { e.printStackTrace(); } } }