Some programming languages permit arbitrary flow of control from any place in a program to any other place in the program. Not Java. What is the rationale for Java not allowing that?
Besides portability, another of Java's key advantages is its set of security features which protect a PC running a Java program not only from problems caused by erroneous code but also from malicious programs (such as viruses). You can safely run a Java applet downloaded from the Internet, because Java's security features prevent these types of applets from accessing a PC's hard drive or network connections. An applet is typically a small Java program that is embedded within an HTML page.