Java has a big advantage over CGI because it is run on the client (ie - your) computer, rather than the server (ie, the computer you downloaded the data from). This means that if a lot of people all decide to visit your page at once, the server doesn't grind to a halt.
But, it can take time for an applet to download. Not all browsers are able to run Java applets
For a nice example of some mathematical Java applets, may I recommend Mr Math...
Of course, I can hear one or two virtual objections. Java is hard (not as difficult as some languages). However, point and click interfaces for programs that create java applets are already here.