I'm a C# programmer trying to hack at a Java project. Here's an anonymized extract from our production code. It works (I think). Note that this is the whole class.
public class Y extends X
{
public Z m_Z;
protected void readCustomData (CustomStream reader, boolean forUpdate)
throws IOException, FTGException
{
super.readCustomData (reader, forUpdate) ;
m_Z.readBinaryData (reader, forUpdate) ;
}
protected void writeCustomData (CustomStream writer, int original)
throws IOException, FTGException
{
super.writeCustomData (writer, original) ;
m_Z.writeBinaryData (writer, original) ;
}
}
What puzzles me is - where is m_Z
initialized? I cannot find it in the entire codebase. So why don't the readCustomData
and writeCustomData
methods fail with NullReferenceException
- or whatever the equivalent is in Java? Is m_Z
somehow automagically constructed along with Y
? Or have I missed something after all and there is some deeper magic in the codebase which initializes it?