+ 4

What is the difference between java and c++

1st Dec 2016, 12:07 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
9 Answers
+ 7
Now to actually answer the OP's question. You're comparing Apples to Oranges, like seriously. The differences are somewhat extensive but outside of syntax(duh). You should ask what said language Excell at rather than differences.
1st Dec 2016, 12:37 AM
Don
Don - avatar
+ 4
C++ doesn't force it's programmers to code in a set style like that of Java, and C++ supports OOP and functional programming paradigms. Java is both compiled and interpretered. Now the rest of what was said....Not going to even enlighten the ignorance.
1st Dec 2016, 12:31 AM
Don
Don - avatar
+ 2
14. There is no goto statement in Java. 15. Exception and Auto Garbage Collector handling in Java is different because there are no destructors into Java. 16. Java has method overloading, but no operator overloading just like c++. 17. The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion, 18. Java is pass-by-value. 19. Java does not support unsigned integer. Written By Luis Velázquez • C++ compiled binaries run natively on OS level but Java compiled "bytecode class" files run inside a virtual machine named JVM. Thus, C++ compiled binaries need to be compiled against a particular OS to port but Java compiled classes can be easily ported between different OS's as long as they have JVM. This is a great feature but also has its own downsides since every single feature that Java has needs to be applicable on each OS. Most important lack of feature caused by this is "Raw Sockets". • C++ is a OOP language like Java but it is possible to write non-OOP code with C++, it allows you to do it but Java doesn't. Java forces you to write OOP code. • C++ has pointer arithmetics, Java does not want you to deal with pointers directly. This is because, it is possible to hack OOP logic by using pointers and Java does not want users to do it. Many developer find it as a downside but it makes your code more secure and bug free. • Java has a garbage collector to free unused resources. Written By:- Ozgur Demir Jun 14, 2015 Java is a pure object oriented programming language; therefore, everything is an object in Java (single root hierarchy as everything gets derived from java.lang.Object ). Java is a memory-safe language, whereas C++ is not.Similar errors in C++ lead to undefined behaviour, where instead of raising an exception or crashing, your program might keep running and crash later or even give the wrong answer or behaviour. C++ programming is much more error-prone that Java programming.
1st Dec 2016, 1:48 AM
M.J
M.J - avatar
+ 2
java is java and c is c.
1st Dec 2016, 9:41 AM
Nguyễn Hoàng Long
Nguyễn Hoàng Long - avatar
+ 2
@Don Not to say that I like Java (cuz I *really* don't), but that's no longer strictly accurate. Modern Java uses JIT compilation if supported, which means that the program is running natively.
1st Dec 2016, 4:00 PM
Nemo
+ 1
https://en.m.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B Let's say Java is easier for u now and when u start learning from real books (not courses) u will see diferences. I say real books because then u will learn abouth memory representation, alocation, garbage collector and "no g-collector Xd"; and other optimisation related stuff (etc. etc.). For now, go with easier syntax and I think it's Java.
1st Dec 2016, 12:58 AM
Petar Suvajac
Petar Suvajac - avatar
+ 1
1. C++ supports pointers whereas Java does not pointers. But when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers.” So we can say Java supports Restricted pointers 2. At compilation time Java Source code converts into byte code .The interpreter execute this byte code at run time and gives output .Java is interpreted for the most part and hence platform independent. C++ is run and compiled using compiler which converts source code into machine level languages so c++ is platform dependent. 3. Java is platform independent language but c++ is depends upon operating system machine etc. C++ source can be platform independent (and can work on a lot more, especially embedeed, platforms), although the generated objects are generally platofrom dependent but there is clang for llvmwhich doesn't have this restriction. 4. Java uses compiler and interpreter both and in c++ their is only compiler 5. C++ supports operator overloading multiple inheritance but java does not. 6. C++ is more nearer to hardware then Java 7. Everything (except fundamental types) is an object in Java (Single root hierarchy as everything gets derived from java.lang.Object). 8. Java does is a similar to C++ but not have all the complicated aspects of C++ (ex: Pointers, templates, unions, operator overloading, structures etc..) Java does not support conditional compile (#ifdef/#ifndef type). 9. Thread support is built-in Java but not in C++. C++11, the most recent iteration of the C++ programming language does have Thread support though. 10. Internet support is built-in Java but not in C++. However c++ has support for socket programming which can be used. 11. Java does not support header file, include library files just like C++ .Java use import to include different Classes and methods. 12. Java does not support default arguments like C++. 13. There is no scope resolution operator :: in Java. It has . using which we can qualify classes with the namespace they came from. 14 ... 18
1st Dec 2016, 1:35 AM
M.J
M.J - avatar
0
java is an interpreted program which is thoroughly based off of OOP( Object Orientated Programming), c++ unlike java has no objects and code is all under one main class...this is note procedural based and a compiling program.... interpreted and procedural are just ways the program allows byte code to be read. :) just to explain it on a more simpler and easier term, unlike some people
1st Dec 2016, 12:19 AM
Randy
Randy - avatar
0
Unlike don, I feel as though you asked a good and simple question.... there's no such thing as a bad question
1st Dec 2016, 12:38 AM
Randy
Randy - avatar