Entrance Exams
Govt. Exams
Mode 'r' allows read-only access. Write operations will throw IOException.
Externalizable requires implementation of writeExternal() and readExternal() for complete control over serialization.
reset() clears ObjectOutputStream's internal cache of serialized objects, allowing duplicate objects to be serialized again.
Pipes require separate threads for reading and writing. Using both in the same thread causes deadlock.
read() returns integer values of bytes. [65, 66, 67] are ASCII values for 'A', 'B', 'C'. Multiple read() calls return these values sequentially.
PrintStream (used by System.out) is internally synchronized for thread-safety, unlike other stream classes.
Transient fields are excluded from serialization and are initialized to default values upon deserialization.
Filter streams are chained from inside-out. FileReader is wrapped with BufferedReader for better performance.
DataInputStream with buffering allows sequential reading without loading the entire file into memory, making it ideal for large files.
A class must explicitly implement the Serializable interface to be serialized. Static fields are not serialized, and not all classes are serializable by default.