1.10. Sample Java Application

An application is what is normally called a program: source code that is compiled and directly executed. In order to create an application in Java, the program must have a class that defines a method called main. The main() method in the class is the starting point for the execution of any application.

Essential Elements of a Java Application

Example 1.4 is an example of an application in which a client uses the CharStack class to reverse a string of characters.

Example 1.4. An Application
 // Source Filename: Client.java public class Client { public static void main(String[] args) { // Create a stack CharStack stack = new CharStack(40); // Create a string to push on the stack String str = "!no tis ot nuf era skcatS"; ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.