C++ vs Java

Facebooktwitterredditpinterestlinkedinmailby feather
  C++ Java C
  C++ is a general programming language created by Bjarne Stroustrup as an extension of c language      Java is class-based, object-based, and designed to have as few implementation dependencies as possible.   C is considered as all programming language father, and It is a general-purpose, procedural programming language supporting structured programming, lexical variable scope, and recursion.
Developer C++ programming language was invented by Bjarne Stroustrup in 1979 Java language was invented by James Gosling in 1991 C language was invented by Dennis Ritchie in 1972
Programming Paradigm In C++ the programming paradigm follows the Object-Oriented programming The programming supports pure Object-Oriented Programming C is entirely a procedural language.
Origin The C++ programming language is based upon C language. Java is based on both C++ and the C language. C language is based on assembly level language.
Translator C++ follows compiler to translate the code into binary-level code. Java uses an interpreter to translate the code in binary codes. C also uses a compiler to translate the code into binary level code.
Platform dependency C++ programming language is platform dependent. Java is platform-independent as the code written on one platform can run on any platform. C is also platform dependent.
Code Execution C++ supports direct code execution. Java follows JVM which Is Java Virtual Machine. Code will be sent to JVM for translation and code execution. C language follows direct code execution.
Approach C++ supports the bottom-up approach. Java also supports bottom up approach. C language supports top down approach.
File generation It generates a .exe file after compiling the program. It generates a .class file after compilation of a program It also creates a .exe file.
Pre-processor directives C++ follows #header and #define to include the pre-processor directives. Java uses the import option to import the packages it needs to compile the program it is running C being the predecessor of CPP it also follows #header and #define to include
Key words C++ language has 63 defined keywords. Java language has 50 defined keywords. C language has the support for 52 keywords.
Data Types Data types like union and structure are supported in C++ programming. Structure and Union are not supported in Java. Data types like union and structure are supported in C language also.
In heritance Cpp and Java both support inheritance But Java does not support multiple inheritances. To support Java has to use a unique feature called interface Does not support inheritance
Overloading C++ support overloading through polymorphism. Operator overloading is not supported by Java. Overloading is not supported by C language.
Pointers C++ supports pointers. Java does not support pointers. C supports pointers.
Memory Allocation Cpp uses the new keyword to allocate memory to a program and to delete it uses “delete” keyword Java uses the new keyword to allocate memory and uses a unique feature called garbage collector to remove the unwanted memory space. When comes to C language we use calloc(), malloc() and realloc() function to allocate the memory to a particular program and we use the free() function if we wanted to delete or free the memory space from the individual application.
Exception Handling C++ supports exception handling. Java also supports exception handling. C does not support exception handling.
Templates C++ supports templates. Java does not support templates. C does not support templates.
Destructors Supported by C++ Not endorsed by Java C does not support the constructor nor destructors.
Multi-threading/ Interfaces Multi-threading is not supported by C++ programming language. Java supports multithreading to overcome the multiple inheritance problem. Being the predecessor of C++, it also does not support multi-threading.
Database connectivity C++ do not support DataBase connectivity. Java supports DataBase connectivity. C language does not support database connectivity.
Storage classes C++  supports the storage class Java does not supports storage class C supports storage class.
Facebooktwitterredditpinterestlinkedinmailby feather