0

C/C++ will generate an cycle include error if headers are included circularly. Python will generate an cycle import error if imports are circular.

Since Java/JVM never generate this kind of errors, how does Java/JVM handle cycle import in its implementation?

linrongbin
  • 2,967
  • 6
  • 31
  • 59
  • 1
    The Java *compiler* compiles both source files at the same time, so it knows both and can handle the cycle. – Andreas Jan 15 '20 at 02:48
  • C/C++/Python import header files; Java does not have header files, so no circular inclusions. Java's import statement is effectively just syntactic sugar to avoid having to put the full package name with every class-name throughout the code. – racraman Jan 15 '20 at 03:08

0 Answers0