Hello guys I've started learning Java and I've heard something about it's slowness. For an experiment I wrote two programms in C++ and Java which seem to be equal
import java.util.*;
class Java {
  public static void main(String args[]) {
    long beg = System.currentTimeMillis();
    for (int i = 0; i < 200000000; ++i) { }
    long end = System.currentTimeMillis();
    System.out.println(end - beg);
  }
}
outputs 334
#include <cstdio>
#include <ctime>
int main() {
      double beg = clock();
      for (int i = 0; i < 200000000; ++i) { }
      double end = clock();
      printf("%f\n", (end - beg) / double(CLOCKS_PER_SEC) / 1000.0);
      return 0;
}
outputs 0.000810
I am a little confused. Is Java really that slow or I'm doing something wrong?
 
     
     
     
     
    