Java is a common programming language and the basic purpose of Java is to develop network programs. Now it is also used to develop system software’s and programs too. The Java architecture has trade off between speed and efficiency. In case of Java the efficiency beats the speed the execution and rightly so because there are issues which are needed to be addressed in order to become a sound programming language.
Java has some incredible features which are not in any programming language. But these features comes at some price. The features offered by Java makes Java programs slow in execution. Most of you must not be aware of the fact that Java programs are slower than C++ programs. There are some reasons which states that Java programs are slow in comparison to C++ or C.
1. Java ByteCode is slow in interpreting than executing the machine code of C++.
2. Checks on array bounds are made on each and every array.
3. All the variables are checked for type at RunTime.
4. Java programs are dynamically linked and therefore,the programs has to wait for bytecode to get downloaded.
5. Java checks for null values for all the objects at runtime.
6. The garbage collector is not very efficient in sweeping the unused space.
7. There are also no concept of pointers involved in Java.
8. The extra security checks makes Java more slow in executing(interpreting) the programs(ex: Java Sandbox).
With so many security and value based checks the Java is indeed slow but it provides more security which is not provided by any other language.