Can `DataOutputStream` be used to write custom objects directly to a stream?
`DataOutputStream` can write objects directly, provided they are converted to byte arrays first.
Thatâ€™s incorrect. `DataOutputStream` is designed to write primitive types, not objects.
Can you explain how you would handle writing and reading custom objects in Java?