• Animal
  • Auto
  • Computers
  • Education
  • Finance
  • Health
  • Math
  • Mobiles
  • Programming
  • Science
  • Sports
  • Technology
  • Terms
  • Web


  • Difference Between C++ and Java

    C++ vs Java

    Both C++ and Java are high level programming languages which come under 4th Generation languages. Both are Object Oriented Programming Languages. But, They do share some differences between them. Check out the Differences between C++ and Java.

    C++

    C++

    1. C++ (earliar known as C with Classes) was developed by Bjarne Stroustrup in 1979 at Bell Labs.
    2. C++ make use of Pointers and References
    3. C++ binary is not portable meaning binary cannot be run on different OS Platforms.
    4. C++ supports Multiple Inheretence through usage of Virtual Inheritance.
    5. Dynamic Polymorphism is achieved using Virtual Keyword (use of Virtual Pointer [VPTR] and VTable)
    6. C++ doesn’t support Memory Management. The progammer has to take care of Memory Allocation and Deallocation with the operations like New, Delete, Malloc, Calloc and use of Destructors (virtual destructors in case of virtual inheritance)
    7. C++ uses Collections by using STL (Standard Template Library). Its a third-party API
    8. C++ can have Global functions or Global variables which are outside the class
    9. C++ uses namespaces.

    Java

    Java

    1. Java was developed by James Gosling in 1995 at Sun Microsystems (now acquired by Oracle Corporation).
    2. Java uses only References. Pointers are eliminated in Java to remove the complexity from the Programmers.
    3. Java code is portable and is achieved using Java Bytecode (.class) file which can be executed by JVM (JVMs differ based on the OS).
    4. Java doesn’t support Multiple Inheretence (because of Daimond Problem), But supports Interface Inheritance using Interface.
    5. Dynamic Polymorphism is achieved using Method Overiding
    6. Java support Automatic Memory Management using Garbage Collector. The Garbage Collector is a Daemon thread which keeps scanning the memory and clears the objects when the memory is low or required.
    7. Java API comes with Collections package.
    8. Java cannot have Global functions or Global variables
    9. Java uses Packages.

    These are the Difference between C++ and Java, If you know more differences, Do contribute by leaving the comment. I will be happy to add them in this post.

    Posted under: Programming
    1957 readers are already subscribed to this blog! Why don't you be one of them? Subscribe to this blog via your favorite RSS feed reader or by entering your email address on the form below:








    Leave a Reply

    page counter
    NiharsWorld on Twitter NiharsWorld on Facebook NiharsWorld RSS Feed