Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Data Structures Organizing Data Serialization

How does the compiler cast in background?


I wonder how the compiler knows how to "translate" a given object (e.g. read by the ObjectInputStream) to a Treet[]-Object (or any other user defined object).

From my point of view the compiler reads the object out of a byte-stream (like FileInputStream) and somehow translates it to an object... but how?

I'd really like to understand the mechanics behind this if that's not an awful big study itself.

Thanks for reading and your answers in advance, Michael

1 Answer

I would recommend reading this JVM Internals blog that goes into detail on how Java works. For your question I would start at the Class File Structure section.

Thanks for the reply! I'll have a look at it asap.