In JavaScript the focus is on responding to events


In JavaScript the focus is on responding to events. A user action produces an event that triggers a JavaScript event handler, which does something useful.
In Java, user events are handled very differently. When the user loads a Web page containing Java code, in the form of a Java applet, the browser tells the applet to start. When the user leaves that page the applet is told to stop.