Hi
Thanks both of you for being gentle with me though I'm still struggling. Your main point is, I think, that there are no other references in Second to f or First. This has puzzled me as to how to interpret the reference material (I realise now I should have linked to
http://download.oracle.com/javase/tutorial/java/javaOO/summaryclasses.html ) - this appears to imply that no further reference is necessary, as
objectReference.variableName is cited there.
1. I don't think you are asking me to define
First f; in the constructor of Second, which doesn't compile, nor
First f;
or
First f = new First();
in the header area before the constructor, both of which interestingly compile and produce run time errors.
2. As an aside I can also see that if I change dummy to be a static variable (and if I correspondingly change the reference in Second to First.dummy) then it compiles and runs, but the whole point is that I want to reference an instance variable, not a class variable.
3. I can see now that I've made another error in that I've not made dummy public, but as Paul says this seems irrelevant as it is the instance f of First that the compiler has given up on.
4. Also, and you can see I'm guessing now, it doesn't appear to help to move the instantiation of "s" to the main block.
I think the question I am having trouble with is that if this simple example will not compile because of the apparently obvious reason that First is not visible from Second then I can't see how to generalise so that any class can access any instance variable of another.
Any next clues much appreciated!