Bloomberg LP Interview Question
Financial Software DevelopersCountry: United States
Interview Type: Phone Interview
First and foremost Java is a platform with it's JVM. C++ is not - It is a language working with OS API and extension libraries (some are standard some are not: for example Java has multitasking mefchanisms built-in in JVM and available to developer). C++ is source code portable (to degree) and Java is binary portable (you do not need to recompile Java code when moving on different OS or between versions of OS)
Also inefficiencies in communicating with native libraries is relative term. It could be the same inefficient depending on platform.
There are hundrerds of minor diffrerences: Java: no scope programming, no pointers, no unions, main function different, access levels to members are not exactly the same (Java has default/package), in Java you cannot make member more private unlike in C++, no destructor in Java, all methods are either virtual or static in Java while in C++ member can be non-virtual and non-static e.t.c. Not to mention new specification differences like lambda constructs existing in one coming in another (not yet available)
In addition to everything mentioned above:
1. Java has exception handling
2. Java does not allow operation overloading. C++ allows this
3. Java does not support multiple inheritance and hence does not have virtual.
4. Since everything is an object in java, it does not need function prototypes.
1) c++ supports multiple inheritance, but java doesn't support directly.
- Anonymous March 28, 20132) Programmer responsible for memory management in C++, but JVM will take care of it by GC
3) C++ requires some code tweaks to run on different platforms, but java doesn't require any code changes due to byte code handled by JVM
4) C++ can communicate well with native libraries (kind of OS and drivers), but Java is not that efficient directly even though JNI is available.
5) Java is quite suitable for Web based applications compare to C++
6) C++ is quite suitable for low level programming compare to
7) C++ supports call by value and call by reference, but java doesn't support call by reference, infact it is call by reference value.