by S. Ryan

Book on the Java API is a must-have for Java programmers

news
Aug 1, 19962 mins

<em>The Java Application Programming Interface Volumes I & II</em> by James Gosling and Frank Yellin

So you already have a bookshelf full of the classics. Well, make room next to K&R, Knuth, and the dragon book because this set is absolutely essential for Java programmers. This book belongs in that rarefied company because it has exactly the information a Java programmer needs โ€” arranged so that it is a joy to use. And itโ€™s written by the folk who know the language best.

public ThreadGroup(ThreadGroup parent, String name)

Creates a new thread group. the parent of this new group is the specified thread group.

The checkAccess method of the parent group is called with no arguments; this may result in a security exception.

Parameters: parent: the parent thread group

name: the name of the new thread group

Throws: NullPointerException

if the thread group argument is null.

Throws: SecurityException

if the current thread cannot create a thread in the specified thread group.

This kind of information can be invaluable to the coder sitting there โ€” one hand on the keyboard and the other holding the reference. Taking this one step further, the authors describe one of ThreadGroupโ€™s enumerate methods:

enumerate
public int enumerate(Thread list[]) 

Copies into the specified array every active thread in this thread group and its subgroups.

An application should use the activeCount method to get an estimate of how big the array should be. If the array is too short to hold all the threads, the extra threads are silently ignored.

That short note will save Java programmers a lot of time. As Gosling said in his keynote at JavaOne, heโ€™s made just about every mistake there is to be made, coding-wise. And he doesnโ€™t think he has the time to make those mistakes again. Fortunately for us, he doesnโ€™t think we have the time either.

Even if these volumes only contained the minutia of each class and interface, they would be essential to the Java programmerโ€™s library. However, thereโ€™s more than that. Theyโ€™re written to the reader, not as a simple rehash of the spec. These two volumes are truly valuable and merit a place on every Java coderโ€™s bookshelf.

S Ryan is former technical editor at NetscapeWorld. In a former life, she was a software engineer, IS manager, and professional tiddleywinks competitor.