How to inherit from the main class in java
- by user225269
I have two java classes. One is NewFrame.java where the forms(buttons, textfields) are located. And the other one is Main.java where I have put the connection string for mysql:
Main.java looks like this:
    public class Main {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
        // TODO code application logic here
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee_record", "root", "password");
        PreparedStatement statement = con.prepareStatement("select * from employee");
        ResultSet result = statement.executeQuery();
    }
}
How do I inherit from the main.java so that the declarations in it would be universally accessible to the forms in NewFrame.java?
Please help. Thanks