This discussion marks the beginning of the third phase of our consideration of Java. In the first, the discussion covered the basics needed to create a very simple applet. In the second, the discussion revisited many of the same topics, but in sufficient depth to enable you to create a "real" applet. In this third phase, the discussion will discuss some of Java's more advanced features, with the emphasis on building network-oriented programs, such as client/server applications.The discussion begins, however, with basic input/output. I find it interesting that it has not been until this point that we have really needed I/O capability. Until now, all interaction has been between user and the Java applet through user interface components. With a conventional language, the discussion usually begins with basic I/O, e.g., the ubiquitous Hello, World! program. The difference between Java and these other languages is not in the languages, per se, but in the contexts. Java fits naturally into the context of the Internet and the World Wide Web. Within that infrastructure, I/O is not a prominent aspect of the system from the user's perspective. I/O is required, however, for communication between networked components, as will be seen shortly. And, of course, one can write conventional Java applications outside of the WWW context, where I/O plays its traditional role.
After discussing basic I/O, we will take a first look at some of Java's networking capabilities in the form of simple client and server programs. We next consider threads, enabling Java programs to present the logical appearance of multiple strands of processing to be occurring at the same time. Threads, in turn, let us return to client/server architecture and consider a more typical client/server design in which each connection with a client program is handled by a separate thread in the server.
Topics
- Discuss basic Java input/output.
- Exceptions
- File classes
- Data stream classes
References
Useful references include:
- Sun's Java Development Kit (JDK)
- The API
- The API Class Hierarchy
- Source Code for JDK Packages
Assignment for Next Class
- Read Java Clients and Servers I class tutorial.