Difference between c++ and java



C++ was designed for systems and applications programming, extending the C programming language. To this procedural programming language designed for efficient execution. Java is a statically typed object-oriented language that uses similar (but incompatible) syntax to C++. Both are object oriented programming languages. The following are the difference between c++ and java.
                  C++
                   Java
  1. it is not pure object oriented programming language, so it is possible to write c++ programs without using a class or object.
  2. C++ compiles to machine language. C++ run and compile using compiler which converts source code into machine level languages so c++ is plate from dependents.
  3. It is system dependent.
  4. Pointer and goto statements are there.
  5. Allotting memory and deallocating memory is the responsibility of the programmer.
  6. Automatic casting is available.
  7. Multiple inheritance is available.

  1. Operator overloading is available.
  2. C++ supports 3 access specifiers: private, public, protected.
  3. There are constructors and destructors in c++.
  4. #define, typedef and header files are available in c++.
  5. Pass-by-value and pass-by-reference is available.
  1. It is purely an object oriented language, since it is not possible to write a java program using atleast one class.
  2. Java compiles to byte code. At compilation time Java Source code converts into byte code .The interpreter execute this byte code at run time and gives output.
  3. It is system independent.
  4. We cannot create and use pointers .
  5. Allocation and deallocation of memory will be taken care by jvm
  6. Implicit casting is available , but it is advisable that the programmer should use casting wherever required.
  7. Multiple inheritance is not there but we can achieve by using interface.
  8. Operator overloading is not available.
  9. Java supports 4 access specifiers : private ,public ,protected and default.
  10. Only constructors are there in java. No destructors.
  11. Java does not support header file, include library files just like C++ .Java use import to include different Classes and methods.
  12. Only Pass-by-value is available.
Parts of java
Sun Microsystems has divided java into 3 parts. They are java SE, java EE, java ME.
Java SE: it is the java standard edition that contains basic core java classes. This is the core Java programming platform. It contains all of the libraries and APIs that any Java programmer should learn (java.lang, java.io, java.math, java.net, java.util, etc...). This edition is used to develop standard applets and applications.
Java EE: it is java enterprise edition and it contains classes that are beyond java SE.  we need java SE in order to use many of the classes in java EE. it provides libraries for database access (JDBC, JPA), remote method invocation (RMI), messaging (JSM), web services, XML processing, and defines standard APIs for Enterprise JavaBeans, servlets, portlets, JavaServer Pages, etc. This is used to develop business applications.
Java ME: it stands for java micro edition. JavaME provides a subset of the functionality of JavaSE, but also introduces libraries specific to mobile devices. It is for developers who develop code for portable devices, such as mobiles.

No comments:

Post a Comment

Genuine websites to earn money.

If you are interested in PTC sites then this article is for you. I have personally tried many of the sites and found that the best thing ...