I did a simple test, I know C++ is faster but the results of my test is unrealistic.
C++ code is:
#include
#include
First of all, you probably don't want the respective print functions to be part of your benchmark unless you really care how fast those are.
There's not a straight answer as to whether Java or C++ is faster...it depends. Java can be faster when the compiler can do some optimizations that would not be available for C++. So it depends on what specifically you are doing and what the compiler options are.