java - Question about static member variables -
in following code, assumption member variable mbar instantiated upon first construction of foo object... , mbar instantiation shared future foo objects, bar() constructor not called again. accurate?
public class foo { private static bar mbar = new bar(); public foo() { }
the object might constructed way before creation of first foo.. executed when classloader loads foo.class in memory , can happen pretty @ time.... when load other classes use foo class, or when call static method of class....
Comments
Post a Comment