<Table> <Tr> <Th> Java / C++ statement </Th> <Th> C++ generated code (x86) </Th> <Th> Java generated byte code </Th> </Tr> <Tr> <Td> vector (i) + +; </Td> <Td> mov edx, (ebp + 4h) mov eax, (ebp + 1Ch) inc dword ptr (edx + eax * 4) </Td> <Td> aload_1 iload_2 dup2 iaload iconst_1 iadd iastore </Td> </Tr> </Table> <Tr> <Th> Java / C++ statement </Th> <Th> C++ generated code (x86) </Th> <Th> Java generated byte code </Th> </Tr> <Tr> <Td> vector (i) + +; </Td> <Td> mov edx, (ebp + 4h) mov eax, (ebp + 1Ch) inc dword ptr (edx + eax * 4) </Td> <Td> aload_1 iload_2 dup2 iaload iconst_1 iadd iastore </Td> </Tr> <P> Since performance optimizing is a very complex issue, it is very difficult to quantify the performance difference between C++ and Java in general terms, and most benchmarks are unreliable and biased . Given the very different natures of the languages, definitive qualitative differences are also difficult to draw . In a nutshell, there are inherent inefficiencies and hard limits on optimizing in Java, given that it heavily relies on flexible high - level abstractions, however, the use of a powerful JIT compiler (as in modern JVM implementations) can mitigate some issues . In any case, if the inefficiencies of Java are too great, compiled C or C++ code can be called from Java via the JNI . </P>

When would java be used over c/c++