eguruchela

What is the difference between CPP (C++) and JAVA?


Answer:

The prime difference between CPP and Java is that CPP is only a compiled language while Java is both compiled and interpreted.

The CPP compiler converts the source code into machine code and therefore, it is platform dependent.

CPP Vs JAVA

HardwareCPP is nearer to hardware. Java is not so interactive with hardware.
Virtual Keyword It has Virtual keywords.It doesn’t have Virtual Keyword.
Platform Dependency Platform dependent, needs to be compiled for different platforms. Platform independent, Java bytecode works on any operating system.
Portability CPP is platform dependent. Therefore it is not portable. It can run in any Operation System therefore it is portable.
Compilation CPP is a Compiled Language.Java is both Compiled and Interpreted Language.
Memory ManagementIt is Manual. It is System Controlled.
Multiple InheritanceIt supports both single and multiple Inheritance. It supports only single inheritance. Multiple inheritances are achieved partially using interfaces.
Overloading It supports both method and operator overloading. It supports only method overloading and doesn’t allow operator overloading.
PointersIt strongly supports pointers. It has limited support for pointers.
Libraries
  • It supports direct system library calls, making it suitable for system-level programming.
  • CPP libraries have comparatively low-level functionalities.
  • It doesn’t support direct native library calls but only Java Native Interfaces.
  • Libraries have a wide range of classes for various high-level services.
  • Documentation CommentIt doesn’t support documentation comments for source code.It supports documentation comments for source code.
    Thread Support CPP doesn’t have built-in support for threads, depends on third-party threading libraries. Java provides built-in support for multithreading. 
    Programming TypeCPP is both a procedural and an object-oriented programming language. Java is only an object-oriented programming language.
    I/O mechanismCPP uses cin for input and cout for an output operation.Java uses the (System class): System.in for input and System.out for output.
    goto KeywordCPP supports goto keyword. Java doesn’t support goto Keyword
    Structures and UnionsCPP supports Structures and Unions.Java doesn’t support Structures and Unions.
    Parameter PassingCPP supports both Pass by Value and pass by reference.Java supports only the Pass by Value technique.
    Object ManagementIt supports manual object management using new and delete.Automatic object management with garbage collection.
    Call by Value and Call by reference CPP supports both (call by value and call by reference).Java supports only call by value.

    👈       👉