To accept a connection in Java, you can call the accept() method on a server socket. This method blocks until a client connects to the server.