JavaData & JavaBack to Basics: Understanding How Java 6 Programs Work

Back to Basics: Understanding How Java 6 Programs Work content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

When the Java language was introduced, the language feature that got the most attention was applets, Java programs that run on web pages. Aside from the obvious difference of where they run, applets differ from desktop Java applications in a number of important ways. For example, the structure of applets differs from applications. Unlike applications, applets do not have a main() block. Instead, they have several sections that are handled depending on what is happening in the applet. Distinctions like these affect the way the two types of application function and the way they are created.

Understanding How Java Programs Work,” an excerpt from Sams Teach Yourself Java in 24 Hours, 5th Edition, walks through creating both a Java application and an applet in NetBeans. Along the way, it covers all the basics:

  • How applications work
  • Organizing an application
  • Sending arguments to an application
  • How applets work
  • The required parts of an applet
  • Sending parameters to an applet
  • Using HTML tags to put an applet on a web page

You can also run Java applications from a command line using a Java interpreter such as the one used behind the scenes by NetBeans. When a Java program is run as a command, the Java interpreter loads the application and the command can include extra items of information. The excerpt covers that as well.

Download the PDF to get the full excerpt of “Understanding How Java Programs Work” from Sams Teach Yourself Java in 24 Hours, 5th Edition.

This excerpt is from the new book, Sams Teach Yourself Java in 24 Hours, authored by Rogers Cadenhead, published by SAMS Publishing, Nov. 2009, ISBN 0672330768, Copyright 2010 by SAMS Publishing. To see a full table of contents, please visit All rights reserved.

About the Authors

Rogers Cadenhead is a writer, computer programmer, and web developer who has written 21 books on Java and Internet-related topics, including Sams Teach Yourself Java 6 in 21 Days. He maintains the Drudge Retort and several other popular web sites that receive more than seven million visits a year.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories