both java and c++ follows object oriented programming approach but the main difference is: c++: it is a object oriented language, but not platform independent,ieC++ is platform depending meaning that it has to be recompiled for each platform you want it to work on.c++ code is different for each platform(widows,unix,linux)
compared to java , c++ is faster.
compared to java, c++ does'nt consists security
c++ follows MZ format for windows to convert high to low level language in windows and for linux its different so it is platform dependent
java: java is platform independent language meaning java has byte code, java byte code is like a write once and run any where type. basically java consists compiler and interpriter
compiler converts high level language to byte code which similar to binary code but not completly.
interpriter interprits each and every line of byte code and converts in to mechine level language, java interpriter is nothing but jvm
java is slower then c and c++ because java follows sandbox security model.
in java all compilers are equal but jvm is different for each platform
Off the top of my head, some of the main differences are listed below:
1. C++ is compiled directly to native code whereas Java is compiled to an intermediate byte code which is then converted 'on the fly' to native code for the underlying platform.
2. C++ supports multiple inheritance but Java supports only single inheritance.
3. All methods in Java are virtual by default but non-virtual by default in C++.
4. C++ supports pointers but Java does not.
5. C++ supports passing parameters by reference but Java does not.
shanmukha kommojuPosted Oct 11, 2012, 11:56 AM
c++:
it is a object oriented language, but not platform independent,ieC++ is platform depending meaning that it has to be recompiled for each platform you want it to work on.c++ code is different for each platform(widows,unix,linux)
- compared to java, c++ does'nt consists security
- c++ follows MZ format for windows to convert high to low level language in windows and for linux its different so it is platform dependent
java:java is platform independent language meaning java has byte code, java byte code is like a write once and run any where type.
basically java consists compiler and interpriter
VulpesPosted Oct 11, 2012, 7:03 AM
Off the top of my head, some of the main differences are listed below:
1. C++ is compiled directly to native code whereas Java is compiled to an intermediate byte code which is then converted 'on the fly' to native code for the underlying platform.
2. C++ supports multiple inheritance but Java supports only single inheritance.
3. All methods in Java are virtual by default but non-virtual by default in C++.
4. C++ supports pointers but Java does not.
5. C++ supports passing parameters by reference but Java does not.