Here are a few tips for Java Programmers:
The best books on Java that I've found are:
"Effective Java" by Joshua Bloch (2nd Edition was released
in 2008)
"Java
in a Nutshell" by David Flanagan (the third edition covers JDK 1.2 &
1.3 but with each edition the extra information is getting more and more sparse
so it's nice to have all three editions.)
"just JAVA"
by Peter van der Linden
Documentation of how to do common tasks:
Compression (Zip)
Conversions & Numeric Formatting
Data Structures
Drag and Drop (data transfer via DnD)
File Info (system properties and other tidbits
related to the file system)
Jar Files
Parsing Text
Real Numbers (BigDecimal)
Serialization
Sorting
Code
Snippets from Sun
XML (XML processing with Java)
Swing
Java can be a bit mysterious in what it does and what it doesn't do for you. When updating a GUI window (adding or removing a visual component) that is live (displaying) use validate() to cause the GUI window to update itself (repaint() can be a better choice).
javac
The JDK 1.1 changes the functionality of the javac compiler. Instead of reporting errors to the standard output it sends them to the standard error stream (which can't be captured at the command line). Frank Singleton (vk3fcs@ix.netcom.com) wrote and posted a small Java helper application compile.java that calls the compiler and redirects the output for you.
Pitfall
If you think you are overriding the default constructor when you create a class but actually create a method (syntax "void myClass()" rather than "public myClass()") no warning or error message will be generated. However if you were counting on your constructor to initialize some class variables unexpected errors can show up in your program. (Because your constructor won't be used! The default constructor will be executed instead!)
Printing
Java 1.1 added printing support to the AWT, but if you need quick and dirty printing (or for 1.0.2) on a Win95/NT machine you can open a file to "LPTx:" and write to it - presto, you've got printing!
Warning: Bug ID 4701434 - "Printable" makes no guarantee as to how many times it will be called to print a page. Testing shows that it calls to print a page twice, the first being a bogus call, hence you must write print routines that don't fail if called more than once (i.e. this effects how you walk through your data). The quick and dirty fix is to ignore the first call to print (in a Printable class).
Applets
Using the default VM (1.1.x) provided with current browsers sound is extremely limited. Sound files must be "au" format at 8Khz with uLaw encoding.
SQL
JDBC drivers can be found at: http://developers.sun.com/product/jdbc/drivers/index.html
Last modified: May 22, 2008