What are the differences between C++ and JAVA?
The C++ programming language is far more complex than the Java language. Due to this, C++ coding is more error prone than Java code.Java is reusable and more reliable,more secure than c++. Java supports classes, but does not support structures or unions, does not support operator overloading and automatic type conversions.Java does not support pointers too.Generally Java is more robust than C++ due to the following: - Object handles (references) are automatically initialized to null. - Handles are checked before accessing, and exceptions are thrown in the event of problems. - You cannot access an array out of bounds. - Memory leaks are prevented by automatic garbage collection.
Java is a higher level language, and as such abstracts some of the features of a lower level language away from the programmer, such as pointers and direct memory referencing. It's all about choosing the right tool for the job, neither of them are better than the other, as you can do most things in both languages.
Furthermore, the main difference between Java and C++ lies in it's execution. C/C++ code is compiled into an .exe (on Windows) file - the compiler translates your code into binary directly readable by your OS - whereas the Java compiler will compile your code into Bytecode and only the Java VM (Virtual Machine) can read and execute this code. Eventually, because the Java VM has to translate the code, Java programs are slower than C/C++ programs but your Java programs will be portable; your program will run on almost every OS and you won't have rewrite or recompile anything.
C++ can be used to write low level software for hardware but C is mostly used for that wheras java is more web based like javaapplets on some websites. C++ is more commenly used for behind the scenes programming or computing like OS's in my short experience where java is more on the interactivity side good for websites. A good c++ complier would be bloodshed dev c++ or codeblocks C++ or even eclipse if you want to. Java needs the java runtime environment and the java sdk to run and program for
Dev C++, Codeblocks and eclipse are not compilers they're only IDEs. VC, g++ or Turbo C are compilers.
I know, but for the sake or beginners, using an IDE is much more friendly than a command line complier like GNU g++, borlands stuff. Besides they come packaged with a bunch or stuff i guess i was wrong to call them compliers sorry
Both Java and C++ are object-oriented languages that descended historically from C (as is Objective C). But C++ was designed to be almost always backward compatible with C, and so it preserved even that bad and primitive features of C for the sake of compatibility. The designers of Java, on the other hand, felt free to depart from C and clean up the language, making it type safe and providing garbage-collecting dynamic memory and automatic array bounds checking and many other improvements to C.
Join our real-time social learning platform and learn together with your friends!