Java v/s C++
Apart from being platform independent , what are the other features that makes Java a better approach than C++?
- 4144 Views
- 4 Answers
-
-
- 08 Jul
- 0 Comment
-
-
Java and C++ both are object-oriented programming language but there are differences between these two languages which are listed belowbr /br /1. Pointers: C++ Supports pointer while Java doesn'tbr /br /2. C++ uses compiler while Java uses both compiler and interpreter.br /br /3. C++ supports header files while in case of Java there are no header files supportedbr /br /4. C++ has a goto statement while Java does not have any kind of goto statement.br /br /5. Java supports automatic garbage collection and has no support for destructors as in the case of C++ it has destructors.br /br /6. C++ has a scope resolution operator :: while in the case of Java there is no scope resolution operator.
-
- 08 Jul
- 0 Comment
-
-
C++ is compatible with C source code, whereas, java provides the Java Native Interface and recently Java Native Access as a way to directly call C/C++ code. C++ is Write once, compile anywhere, as Java is Write once, run anywhere/everywhere. C++ runs as native executable machine code for the target instruction set as java runs in a virtual machine. In terms of conversion, allows explicitly overriding types as well as some implicit narrowing conversions(for compatibility with C) but, java strongly follows rigid type safety except for widening conversions. C++ uses single and multiple inheritance of classes, including virtual inheritance and java uses single inheritance of classes. Supports multiple inheritance via the Interfaces construct, which is equivalent to a C++ class composed of abstract methods. In C++, const keyword for defining immutable variables and member functions that do not change the object. Being Const is propagated as a means to enforce, at compile-time, correctness of the code with respect to mutability of objects as in java, final provides a version of const, equivalent to type* const pointers for objects and const for primitive types. Immutability of object members achieved through read-only interfaces and object encapsulation.
-
- 04 Jul
- 0 Comment
-
-
Java is more secure and robust language. It also support private method in interface, it's performance is increased according to java 9.
-
- 28 Sep
- 0 Comment
-
- Which site is best for learning Java?
- Why is Java a programming language?
- What is the JAVA? How to Learn JAVA?
- Native Java Apps vs Hybrid Apps ?
- TIPS AND TRICKS FOR PROGRAMMING IN JAVA
- How can I practice the questions of Programming In Java? Where to find study material?
- What is coding in Java? Expalin your answer
- What is the advantage of Java? Explain your answer
- What is the last date to apply for Programming In Java Examination, please let me know.
- Which software is used for Java programming?
strongC++/strong was designed for systems and applications programming, extending the C programming language. br /strongJava /strongwas created initially as an interpreter for printing systems.It is secure and highly portable. br /Java is a object-oriented language that uses similar (but incompatible) syntax to C++.br /br /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.br /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.br /3.Java uses compiler and interpreter both and in c++ their is only compilerbr /4.C++ supports operator overloading multiple inheritance but java does not.br /5.C++ is more nearer to hardware then Javabr /6.Everything (except fundamental types) is an object in Java (Single root hierarchy as everything gets derived from java.lang.Object).br /7.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).br /8.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.br /9.Internet support is built-in Java but not in C++. However c++ has support for socket programming which can be used.br /10.Java does not support header file, include library files just like C++ .Java use import to include different Classes and methods.br /11.Java does not support default arguments like C++.br /12.There is no scope resolution operator :: in Java. It has . using which we can qualify classes with the namespace they came from.br /13.There is no goto statement in Java.br /14.Exception and Auto Garbage Collector handling in Java is different because there are no destructors into Java.br /15.Java has method overloading, but no operator overloading just like c++.br /16.The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion.br /17.Java does not support unsigned integer.