your server can be any java program that is accepting connections ( UDP or TCP ), this server should have a list of all connected clients, and should manage if they send data packages to the client and how can process them. That means the server is the one that is processing all the game ( or the server is the game itself ), when the server receives certain package it will broadcast instructions on how the clients must behave...
we have a server with 4 players,
1.- a client 2 send a message to server like ( move_on_x:2 )
2.- server receive this message and check whether the player 2 have free space to move 2 pixels on X coordinate, if so then the server broadcast a message to all clients saying player2 cordinate is increased by two, that way all 4 clients will see that the player 2 moved 2 pixels on X axis.
and so on, there should be many messages, like jump, die, attack, decrease hp, etc, etc.
this is just one approach. all multiplayers must have some connection handling to check what happens if the player log in into the server, what happens when the connections is suddenly broken, etc, etc.
they are also diferent arquitectures for online games like p2p, client-server, etc,