Wrap-up
We've covered a significant portion of the Java language in the "Introduction to Java programming" tutorial (see Resources) and this tutorial, but the Java language is huge and a single, monolithic tutorial (or even several smaller ones) can't encompass it all. Here's a sampling of some areas we did not explore at all:
|
Topic |
Brief description |
| Threads | Having a program that does only one thing at a time can be useful, but most sophisticated Java language programs have multiple threads of execution that run simultaneously. For example, printing or searching tasks might run in the background. The class Thread and related classes in java.lang can give you powerful and flexible threading capability in your programs. developerWorks hosts many good resources on threading in your Java code, but a good place to start would be with the "Introduction to Java threads" and "Concurrency in JDK 5.0" tutorials and this series of articles by Brian Goetz. |
| Reflection | One of the more powerful aspects of the Java language (and often one of the most mind-bending) is reflection, or the ability to see information about your code itself. The package java.lang.reflect includes classes like Class and Method that let you inspect the structure of your code. For example, you can find a method starting with get, then call it by calling invoke() on the Method object -- very powerful. Part 2 of the "Java programming dynamics" series by Dennis M. Sosnoski talks about using reflection. |
| NIO | Since JDK 1.4, the Java language has incorporated some more sophisticated I/O capabilities, based on a completely new API called new I/O, or NIO for short. The principal difference is that traditional Java language I/O is based on streams (as we've already discussed), while NIO is based on a concepts called block I/O, channels, and buffers. This block I/O tends to be more efficient than sending single bytes one at a time through a stream. The drawback is that NIO can be conceptually difficult. "Getting started with new I/O (NIO)" by Greg Travis is an excellent tutorial on the subject. |
| Sockets | Your Java language programs can communicate with virtually any program on an IP-enabled device. All you need to do is open a socket connection to an IP address and port on that device. The Java language Sockets API facilitates that. See the "Java sockets 101" tutorial by Roy Miller and Adam Williams for an introduction to the API. The "Using JSSE for secure socket communication" tutorial by Greg Travis shows you how to make your socket communication secure. |
| Swing | The Java language includes extensive support for GUI development, in the form of Swing. The Swing set of APIs includes classes for widgets and other elements to create full-featured user interfaces. There are several important developerWorks resources related to Swing, but a good place to start is the introductory article "The Java 2 user interface" by Matt Chapman. The Magic with Merlin column by John Zukowski addresses more recent changes and updates to Swing. John also hosts the Client-side Java programming discussion forum, so you can get assistance with Swing programming there, too. The "Migrate your Swing application to SWT" tutorial discusses how to migrate from Swing to IBM's SWT, a lighter-weight but still powerful alternative. |
| JNI | When your Java program needs to communicate with another program written, for example, in C, the Java language gives you a way to do that: The Java Native Interface (JNI). This API lets you translate Java language method calls into calls to C functions (for interacting with the OS and such). The developerWorks "Java programming with JNI" tutorial discusses the mechanics of JNI with Java, C, and C++ code. |
| RMI | The Java language Remote Method Invocation (RMI) API allows a Java language program in one process or on one machine to access another Java language program running in another process and/or on another machine. In other words, RMI supports distributed method calls between programs running in different Java VMs. Brad Rubin's "Java distributed objects: Using RMI and CORBA" tutorial gives a solid introduction to RMI, and discusses RMI and CORBA together. You should also check out this article by Edward Harned to learn why RMI is not an off-the-shelf application server. |
| Security | The Java language includes sophisticated security APIs to support authentication and authorization. How can you be sure that those who use your program have permission to do? How can you protect information from prying eyes? The security APIs can help. developerWorks offers an abundance of content related to Java security. Here are just a few: Java security discussion forum hosted by John Peck, a veteran Java programmer and security expert; "Java authorization internals" by Abhijit Belapurkar; and "Java security, Part 1: Crypto basics" and "Java security, Part 2: Authentication and authorization" both by Brad Rubin . |

