Creating Java Classes

We've already seen how to create classes in a rudimentary way: You need to create a class to do anything at all, as when we created the main class for the applications that we've built:

public class app
{
    public static void main(String[] args)
    {
        System.out.println("Welcome to Java");
    }
}

In preparation for the next chapter, let's take a look at a more advanced example. In this case, I'll create a new class named AppFrame based on the Java Frame class, which is what you use to create frame windows (a frame window has a frame, including a border and title bar) in Java. There are two ways to work with graphics in Java: the Abstract Windowing Toolkit (AWT) and the Swing Java packages. In the interests of space, I'm going to ...

Get Inside XML 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.