posted 21 years ago
Note that you don't create ByteBuffers using a constructor; you get them from the static allocate() and wrap() methods. The objects returned by these methods are not instances of ByteBuffer itself, but instances of subclasses of ByteBuffer. The same is true of virtually all of the other java.nio classes. ByteBuffer has abstract methods, but the subclasses actually implement those methods.
Methods like allocate() and wrap() are called abstract factory methods; they allow your code to work with one generic class interface while actually making use of different implementation classes for different situations.