Writing a Multithreaded Socket Server
This example demonstrates the creation of a multithreaded socket server application. The server is currently a simple Echo Server, which simply accepts what the client says and sends it back. The example demonstrates the basic infrastructure for a true multithreaded server application and can be directly enhanced to perform as any server application.
Using BorderFactory class to draw borders on Swing components
JComponent supports drawing specialized borders around itself. This can be done using the setBorder(Border border) method. The javax.swing.border package provides classes to create several types of Border. To create these borders it is advisable to always use the javax.swing.BorderFactory class. This is a factory pattern implementation for creating swing borders.
The Singleton Pattern
Appending data to existing file
This example explains how data can be appended to files by using the RandomAccessFile class. The RandomAccessFile class allows to read and write data at any arbitrary location in an existing file. The following example illustrates how it can be used to append text/binary data at the end of files.
Encoding an image to a JPEG file
Sorting User-defined data structures using the Comparator Interface
Viewing file properties
Using the Random class to create a simple guessing game
This example shows how to use Random object to create a simple Guessing Game, where user is shown 3 doors and has to guess in which door a cub is hiding.
Writing a connection pool
This article attempts to explain a simple way to implement a connection pool for use in your applications. Connection pools are used in various applications to streamline the access to a database or some such resource that needs to be used by various components of the application for brief periods of time.