Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address:

Applications, applets, and hybrids

Java 101 charts a new course, and explores applications, applets, and hybrids

If you've been following Java 101, you know that Jacob Weintraub has created an excellent series of articles designed to help Java newbies become Java developers. However, as Jacob can no longer continue this column, JavaWorld has passed the torch to me.

You'll quickly discover that my route to becoming a Java developer follows a different path. For example, I prefer to talk about the programming aspects of Java that are not object-oriented (such as types, variables, operators, expressions, and statements) before delving into its object-oriented side. I believe that approach will enhance Java 101's natural flow from one topic to another -- a flow that seamlessly moves from start to finish. To facilitate the discussion, occasionally I will present an advanced concept before I fully explain it. As a result, you'll encounter brief explanations about more advanced topics as you work your way through this and future articles.

Java 101 will introduce many example programs. Each program is compiled with Sun's Java 2 Platform, Standard Edition version 1.4 (also known as SDK 1.4) compiler and tested on the Windows 98 SE platform. Although I'll try to keep Windows references to a minimum, that won't always be possible, so I'll warn you when an article strays into the world of Windows.

Because I haven't spent much time dealing with Java from the server perspective, this column will focus on client-side Java. That doesn't mean we won't explore topics such as Remote Method Invocation and JDBC, that bridge the client and server sides. However, I will not present servlets, Enterprise JavaBeans, Java Server Pages, and other server-side topics. To get a better idea of the subjects I will cover, see the sidebar, The Road Ahead, for the Java 101 course outline.

In this month's article, I discuss the structure of application, applet, and hybrid programs. From an application perspective, you might find some overlap from Jacob's earlier articles, but I will also introduce quite a bit of new content.

Program categories

Java gives you the ability to create four kinds of programs: applications, applets, hybrids, and servlets. I discuss the first three programs in this article. To learn more about servlets, please consult the Java 2 Platform, Enterprise Edition documentation.

Applications

An application is a standalone program consisting of at least one class with a main() method. That method features the following signature:

public static void main (String [] args)

The public keyword means main() is callable from outside the class in which it's declared. The static keyword means main() is callable without an object reference. In other words, the JVM does not need to create an object from the class that declares main() before calling main(). Finally, the void keyword means main() doesn't return a value.

As with other methods, main() has a parameter list, a list of types and variable names. In main()'s case, only one parameter appears -- args. That parameter is declared a reference to -- also known as address of -- an array of String objects. Each object contains the contents of an argument passed to the application by way of the program's command line. Note: You do not have to use args as that parameter's name. You can just as easily specify chickens, as in String [] chickens.

1 | 2 | 3 | 4 |  Next >
Resources