This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
The above code compiles without any problem. According to me it should not compile since in the 2nd line of main method since a private variable is directly accessed using object reference. And also the declaration of i is also making forward referencing to the j variable, which should also give an compilation error. Can any one give me proper explanation.......
Thanks and Regards, Kalai Selvan T. [ November 03, 2004: Message edited by: Kalai Selvan ]
posted 11 years ago
All your code is in one class, so access modifiers do not make any difference. A class can always see all of its own members: fields and methods.
Many types of "forward reference" are perfectly OK in Java. See the Language Specification for more details, if you care about them.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.