August 7, 2001

Use StringBuffer for Speedy Servlet Output

Servlets often need to display a lot of HTML. One way to do this is with println() commands and String concatenation. However, String concatenation is an expensive process. It is

Avoid Instantiability of Utility Classes

There are times when almost every programmer comes up with a class that consists only of public static methods. Usually these are some kind of utility classes, which do not

Appending Data to an Existing File

There is a constructor in the class which can be used to append data to an existing file. Usage:public FileOutputStream(String name, boolean append) throwsFileNotFoundExceptionwhere:name – the file nameappend –

How to Make a Swing Component Appear and Disappear

Here’s a very short bit of code that will make a StatusBar hide or show, accordingly: public void viewStatusBar() { /* Hide or show the statusbar */ StatusBarPane().setVisible(!(StatusBarPane().isVisible()));} Just have

Encapsulate Member Objects

Objects frequently contain member objects that need to be exposed.Often, these are not correctly encapsulated, which could lead to problems that are difficult to track down.Consider a Circus object, which