I would give this series of articles a read:
http://gafferongames.com/networking-for-game-programmers/
It's mostly in C/C++, but you can translate it to Java. Learn about UDP sockets in Java, for example:
http://download.oracle.com/javase/tutorial/networking/datagrams/index.html
This should be enough to get you going. I would probably do client-server setup. You can do P2P but it's harder from what I've heard.