Max Rahder wrote:Yeah, non-primitive variables are just references. They are able to reference an object, but don't reference anything unless your code puts something in them. So you either initialize them as you define them, like I did, or you initialize them in the constructor.
ok, we are talking the same thing, but I think here your use here of "reference an object" has a slightly different connotation than mine. By reference an object I meant using an instance method or instance variable of an object that has not been initialized, which can't be done. Perhaps yours is a more accepted use of the terminology, I don't know.
And I agree with you that in the context of this example, there are two different locations where you might initialize the randNum object. I was speaking more generally about the ways it can be done.
may as well be precise.
regards.