When I read the source code of JDK 6.0 I found these two methods in ArrayList. You see they are both private. But after searching, I didn't find any other methods calling either of them. I also considered the native methods, but still couldn't find any. These two methods seem to deal with the IO, but they are never called.
So, my question is, how do they work? Is there any other way to call private methods?
/**
* Save the state of the <tt>ArrayList</tt> instance to a stream (that is, serialize it).
*/
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException;
/**
* Reconstitute the <tt>ArrayList</tt> instance from a stream (that is, deserialize it).
*/
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException;