Interesting I have always used Spring for dependency injection so interesting seeing a 'vanilla' approach particularly for situations where such libraries aren't available to be used. Wouldn't the second Java example result in a NullPointerException when run as the constructor isn't called since the instance isn't initialised?
Ah yes! My mistake! I'll get that fixed :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.