'Purported UDP "connection"

My understanding was that UDP doesn't form connections; it just blindly sends packets. However, when I run

nc -u -l 10002

and

nc -u 127.0.0.1 10002

simultaneously (and so can send messages back and forth between terminals), lsof reports two open UDP connections:

nc ... UDP localhost:10002->localhost:35311 
nc ... UDP localhost:35311->localhost:10002 

If I open a third terminal and do nc -u 127.0.0.1 10002 again, to send another message to the original listener, the listener does not receive (or acknowledge, at least) the message, suggesting it is indeed tied to a specific connection.
If I implement a UDP echo server in Java like this and do sorta the same thing (on 10001), I get

java ... UDP *:10001
nc ... UDP localhost:52295->localhost:10001

aka, Java is just listening on 10001, but nc has formed a connection.

Based on my understanding of UDP, I'd expect both sides to behave like the Java version. What's going on? Can I make the Java version do whatever nc is doing? Is there a benefit to doing so?

I'm on Ubuntu 20.04.3 LTS.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source