0

what the difference betweens java and c++?

JAVA AND C++

12th Mar 2021, 12:01 AM
Ali Bala Abdalla Bala
Ali Bala Abdalla Bala - avatar
3 Respuestas
+ 1
They're very different languages, so much so that I wouldn't even compare them. Java is a bytecode language and executed within a virtual environment, while C++ is a language that compiles down to machine code. Java is a "compile once, run everywhere" language. C++ programs on the other hand need to be compiled seperately for every operating system you want to run it on. Also, Java is a garbage collected language, which means you don't have to free memory allocated on the heap, but you need to do it yourself in C++ (or maybe not if you use RAII or smart pointers). There's a ton of other differences between these two, and they're both great for different programs and problems. C++ is very fast and consistent, Java is a bit sluggish but is more high level.
12th Mar 2021, 12:48 AM
inxanedev!
inxanedev! - avatar
+ 1
علي بله hi C++ uses only compiler, whereas Java uses compiler and interpreter both. C++ supports both operator overloading & method overloading whereas Java only supports method overloading. C++ supports manual object management with the help of new and delete keywords whereas Java has built-in automatic garbage collection.
12th Mar 2021, 9:32 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 1
The first C is a compiled language (you need optimize / have a version of your program by SO), and Java is an interpreted language: you write code that is compiled to bytecode and then by each SO you have a JVM interpeting this bycode With this you can imagine that C is faster than Java when running. With C you need manage memory, Java has garbage collector Normally with C you can work at low level to for example develop drivers, exposing a JNI interface and consume it from Java as native methods.
13th Mar 2021, 1:01 AM
David Ordás
David Ordás - avatar