O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 we've built:

public class ch10_01 
{
    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. This class is what you use to create frame windows (a frame window has a frame including a border and title bar) in Java.

Here's what it will look like in the main method. I'll create a new object named f of the AppFrame class, passing the text we want to appear in that window ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required