I/O, Applets, and
Other Topics
his chapter introduces two of Java's most important packages: io and applet. The io
package supports Java's basic I/O (input/output) system, including file I/O. The applet
package supports applets. Support for both I/O and applets comes from Java's core
API libraries, not from language keywords. For this reason, an in-depth discussion of these
topics is found in Part II of this topic, which examines Java's API classes. This chapter discusses the
foundation of these two subsystems so that you can see how they are integrated into the Java
language and how they fit into the larger context of the Java programming and execution
environment. This chapter also examines the last of Java's keywords: transient, volatile,
instanceof, native, strictfp, a n d assert. It concludes by examining static import and by
describing another use for the this keyword.
I/O Basics
As you may have noticed while reading the preceding 12 chapters, not much use has been
made of I/O in the example programs. In fact, aside from print( ) and println( ), none of the
I/O methods have been used significantly. The reason is simple: most real applications of
Java are not text-based, console programs. Rather, they are graphically oriented programs that
rely upon Java's Abstract Window Toolkit (AWT) or Swing for interaction with the user.
Although text-based programs are excellent as teaching examples, they do not constitute an
important use for Java in the real world. Also, Java's support for console I/O is limited and
somewhat awkward to use--even in simple example programs. Text-based console I/O is
just not very important to Java programming.
The preceding paragraph notwithstanding, Java does provide strong, flexible support
for I/O as it relates to files and networks. Java's I/O system is cohesive and consistent. In
fact, once you understand its fundamentals, the rest of the I/O system is easy to master.
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks