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

Importing Java Packages and Classes

As mentioned, the classes that Sun has put together for you to use are stored in class libraries called packages. The classes we'll use to interact with XML documents in the next two chapters are also stored in packages. Although the java.lang package is already available to your code by default, the classes in other packages are not, and you must import those packages to use them. You can also import individual classes as well as whole packages. Knowing how to do this is very important in Java programming because a great deal of the resources that most programs use are in packages that you have to import.

To import a package, you use the Java import statement, which looks like this (following the Sun conventions, ...

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