You need to compile A before B, and B before A so because the compiler needs to know the structure of a class before it can generate code to invoke its methods.
Javac gives you a way out of this. You compile both classes at once on the command line and in some unspecified amazing way, the compiler sorts the problem out for itself, e. g.
rem compiling a circular reference javac.exe A.java B.java
|
|
You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) |
| http://mindprod.com/jgloss/circularreference.html | J:\mindprod\jgloss\circularreference.html | |
![]() | Please email your feedback for publication,
letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording,
broken/redirected link reports, suggestions to improve this page or comments to
Roedy Green :
| |
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.179.210] | |
| Feedback | You are visitor number 11. | |