Comparison of Java and C++: Difference between revisions

Content deleted Content added
Line 27:
|-
| Compatible with [[C (programming language)|C]] source code, except for a few [[corner case]]s.
| Provides the [[Java Native Interface]] as well as [[Java Native Access]] and more recently [[Java Native AccessInterface#Foreign Function and Memory API|Foreign Function and Memory API]] as a way to directly call C/C++ code. However, native languages are not safe and applications using native methods are susceptible to memory corruption.{{sfn|Bloch|2018|loc=Chapter §11 Item 66: Use native methods judiciously|p=285}} If the code is not carefully written, native methods can lower the performance of the system because the garbage collector is incapable of monitoring or maintaining native memory usage, and there is a cost context-switching between native and non-native code.{{sfn|Bloch|2018|loc=Chapter §11 Item 66: Use native methods judiciously|p=285}}
|-
| [[Write once, compile anywhere]] (WOCA).