First, let's start from commandline options:
-n disables normal output of the buffer. Only lines that are requested to print (e.g. with p command) will be printed
-r enables extended regexp
-e is not really needed when we are specifying sed commands in command line and not from file
Now comes sed commands. There are two, separated with ; character. Sed goes line by line and executes those two commands in order. But only if they match. Here, both commands are prefixed with /SOMETHING/ which means this command is only executed if current line matches SOMETHING regexp.
/jar$/ regexp only matches if current line ends with jar. Similar /class$/ regexp only matches if current line ends with class. Now if particular line matches, it executes two commands in it (they are grouped with {}) - in first case it is x and then d command. In second case it's x and then p command.
x command is eXchange. sed has a buffer that you can use to store some lines. This command exchanges this buffer with current line (so current line goes to this buffer and buffer content becomes current line).
d command discards current line, reads new one and starts executing sed commands from the first one (all the commands after d are ignored for current line).
p command prints current line. Since we use -n command arguments only lines printed with p will be shown at output.
So to sum up:
/jar$/ { x; d; } means - if current line ends with jar, save it in the buffer
/class$/ { x; p; } means - if current line ends with class, get buffer contents (which should contain last line ending with jar, unless there was a file ending with class already) and print it