I was looking for information about the java.nio.ByteBuffer class and noticed that it has a lot of abstract methods. What confuses me is that you can create a ByteBuffer object by calling the static ByteBuffer.allocate or ByteBuffer.allocateDirect methods, and then use the abstract methods on this object. Erhm… how is that possible?
For example:
ByteBuffer bb = ByteBuffer.allocateDirect(4);
bb.putInt(10); // ByteBuffer.putInt(int) is an abstract method, still I can use it :/
System.out.println(bb.getInt(0)); // calling yet another abstract method =|
Here’s a link to the ByteBuffer reference: http://java.sun.com/j2se/1.5.0/docs/api/java/nio/ByteBuffer.html