Back to Basics: Understanding How Java 6 Programs Work

Wednesday Nov 25th 2009 by Rogers Cadenhead
Share:

The Java application and the applet are two distinct types of program. They have several important differences in the way they function and the way you create them. Learn the differences and how to create both in Java 6.

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 www.informit.com/title/0672330768. 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.

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved