So, if you have a script that's not really needed (a virtual kitten with an unseemly interest in the users' cursor is one fine example), and it's fetched externally, eliminate it. If the script is a must-have, but can be deferred until onLoad, try moving the load to the end of the source code to get the page's content displayed faster. You might pay a small penalty in the page's overall load time, though, since the script got a late start.
As to optimizing scripts themselves: abbreviate the names of variables and functions with a vengeance, and always take time to see if somebody else hasn't already coded something similar, smaller, and better.
Java? Don't get me started. Don't even get me started!
Seriously. Java applets are suitable for extremely targeted applications such as a workflow manager on a corporate intranet and that's about it. Initializing Java applets is disastrous for performance and should only be done if the applet's specific functionality is the whole point and purpose of the page.
We're looking 2003 square in the eyes, people. If you're still of the opinion that a Java headline ticker or banner-rotation applet makes for an delightful Web accoutrement, well, I can also get you a real nice deal on some preferred Webvan shares.
I'm not a Flash whiz, but thankfully, I know a couple. Webmonkey Mike Kay offers this quick checklist of optimizations for Flash designers trying to keep animations slim:
Use symbols and keyframes strategically.
Minimize the use of bitmap images, sounds, and video.
Re-use bitmap images, sounds and video rather than using many unique ones.
Utilize compression settings for individual images and sounds, when possible compress them in another program like ImageReady or Fireworks.
Simplify vector images using the Modify -> Optimize menu.
Pace the download so that everything doesn't have to load all at once.
When all else fails, build a preloader and display a "loading" message.