Develop a Java application that connects to a MySQL database and allows users to perform CRUD operations on a table containing information about employees (ID, name, position, salary). Use JDBC for database connectivity.

To create a Java application that connects to a MySQL database and allows users to perform CRUD operations on an employee table, follow these steps:

1. Install MySQL and create the database schema
2. Add JDBC driver for MySQL to your project
3. Create a Java class to manage database connections
4. Create a Java class to represent Employee objects
5. Create a Java class to handle CRUD operations
6. Implement a user interface or main method to interact with the application

Here's a sample implementation of each step:

1. Install MySQL and create the database schema

After installing MySQL, create a new database and a table named `employees` using the following SQL script:

```sql
CREATE DATABASE company;

USE company;

CREATE TABLE employees (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  position VARCHAR(100) NOT NULL,
  salary DECIMAL(10, 2) NOT NULL
);
```

2. Add JDBC driver for MySQL to your project

Add the following Maven dependency to your `pom.xml` file:

```xml
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.26</version>
</dependency>
```

3. Create a Java class to manage database connections

```java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseConnection {
    private static final String URL = "jdbc:mysql://localhost:3306/company";
    private static final String USER = "root";
    private static final String PASSWORD = "your_password";

    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(URL, USER, PASSWORD);
    }
}
```

Replace `"your_password"` with your actual MySQL root password.

4. Create a Java class to represent Employee objects

```java
public class Employee {
    private int id;
    private String name;
    private String position;
    private double salary;

    public Employee(int id, String name, String position, double salary) {
        this.id = id;
        this.name = name;
        this.position = position;
        this.salary = salary;
    }

    // Getters and setters
}
```

5. Create a Java class to handle CRUD operations

```java
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class EmployeeDAO {
    public List<Employee> getAllEmployees() throws SQLException {
        List<Employee> employees = new ArrayList<>();
        String query = "SELECT * FROM employees";

        try (Connection connection = DatabaseConnection.getConnection();
             PreparedStatement statement = connection.prepareStatement(query);
             ResultSet resultSet = statement.executeQuery()) {

            while (resultSet.next()) {
                int id = resultSet.getInt("id");
                String name = resultSet.getString("name");
                String position = resultSet.getString("position");
                double salary = resultSet.getDouble("salary");

                employees.add(new Employee(id, name, position, salary));
            }
        }

        return employees;
    }

    public void addEmployee(Employee employee) throws SQLException {
        String query = "INSERT INTO employees (name, position, salary) VALUES (?, ?, ?)";

        try (Connection connection = DatabaseConnection.getConnection();
             PreparedStatement statement = connection.prepareStatement(query)) {

            statement.setString(1, employee.getName());
            statement.setString(2, employee.getPosition());
            statement.setDouble(3, employee.getSalary());

            statement.executeUpdate();
        }
    }

    public void updateEmployee(Employee employee) throws SQLException {
        String query = "UPDATE employees SET name = ?, position = ?, salary = ? WHERE id = ?";

        try (Connection connection = DatabaseConnection.getConnection();
             PreparedStatement statement = connection.prepareStatement(query)) {

            statement.setString(1, employee.getName());
            statement.setString(2, employee.getPosition());
            statement.setDouble(3, employee.getSalary());
            statement.setInt(4, employee.getId());

            statement.executeUpdate();
        }
    }

    public void deleteEmployee(int id) throws SQLException {
        String query = "DELETE FROM employees WHERE id = ?";

        try (Connection connection = DatabaseConnection.getConnection();
             PreparedStatement statement = connection.prepareStatement(query)) {

            statement.setInt(1, id);
            statement.executeUpdate();
        }
    }
}
```

6. Implement a user interface or main method to interact with the application

```java
import java.sql.SQLException;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        EmployeeDAO employeeDAO = new EmployeeDAO();

        // Add an employee
        Employee newEmployee = new Employee(0, "John Doe", "Software Engineer", 60000);
        try {
            employeeDAO.addEmployee(newEmployee);
            System.out.println("Employee added successfully.");
        } catch (SQLException e) {
            System.err.println("Error adding employee: " + e.getMessage());
        }

        // Get all employees
        try {
            List<Employee> employees = employeeDAO.getAllEmployees();
            for (Employee employee : employees) {
                System.out.println(employee);
            }
        } catch (SQLException e) {
            System.err.println("Error fetching employees: " + e.getMessage());
        }

        // Update an employee
        Employee updatedEmployee = new Employee(1, "Jane Doe", "Senior Software Engineer", 80000);
        try {
            employeeDAO.updateEmployee(updatedEmployee);
            System.out.println("Employee updated successfully.");
        } catch (SQLException e) {
            System.err.println("Error updating employee: " + e.getMessage());
        }

        // Delete an employee
        int employeeIdToDelete = 1;
        try {
            employeeDAO.deleteEmployee(employeeIdToDelete);
            System.out.println("Employee deleted successfully.");
        } catch (SQLException e) {
            System.err.println("Error deleting employee: " + e.getMessage());
        }
    }
}
```

This is a simple example of how to create a Java application that connects to a MySQL database and performs CRUD operations on an employee table. You can extend this code to implement more advanced features or build a user interface for easier interaction with the application.