Differentiate between C, C++ and JAVA.
S.N. | Basis | C | C++ | Java |
---|---|---|---|---|
1 | Origin | The C language is based on BCPL. | The C++ language is based on the C language. | The Java programming language is based on both C and C++. |
2 | Programming Pattern | It is a procedural language. | It is an object-oriented programming language. | It is a pure object-oriented programming language. |
3 | Approach | It uses the top-down approach. | It uses the bottom-up approach. | It also uses the bottom-up approach. |
4 | Dynamic or Static | It is a static programming language. | It is also a static programming language. | It is a dynamic programming language. |
5 | Code Execution | The code is executed directly. | The code is executed directly. | The code is executed by the JVM. |
6 | Platform Dependency | It is platform dependent. | It is platform dependent. | It is platform-independent because of byte code. |
7 | Translator | It uses a compiler only to translate the code into machine language. | It also uses a compiler only to translate the code into machine language. | Java uses both compiler and interpreter and it is also known as an interpreted language. |
8 | File Generation | It generates the .exe, and .bak, files. | It generates .exe file. | It generates .class file. |
9 | Number of Keyword | There are 32 keywords in the C language. | There are 60 keywords in the C++ language. | There are 52 keywords in the Java language. |
10 | Source File Extension | The source file has a .c extension. | The source file has a .cpp extension. | The source file has a .java extension. |
11 | Pointer Concept | It supports pointer. | It also supports pointer. | Java does not support the pointer concept because of security. |
12 | Union and Structure Datatype | It supports union and structure data types. | It also supports union and structure data types. | It does not support union and structure data types. |
13 | Pre-processor Directives | It uses pre-processor directives such as #include, #define, etc. | It uses pre-processor directives such as #include, #define, #header, etc. | It does not use directives but uses packages. |
14 | Constructor/ Destructor | It does not support constructor and destructor. | It supports both constructor and destructor. | It supports constructors only. |
15 | Exception Handling | It does not support exception handling. | It supports exception handling. | It also supports exception handling. |
16 | Memory Management | It uses the calloc(), malloc(), free(), and realloc() methods to manage the memory. | It uses new and delete operator to manage the memory. | It uses a garbage collector to manage the memory. |
17 | Overloading | It does not support the overloading concept. | Method and operator overloading can be achieved. | Only method overloading can be achieved. |
18 | goto Statement | It supports the goto statement. | It also supports the goto statement. | It does not support the goto statements. |
19 | Used for | It is widely used to develop drivers and operating systems. | It is widely used for system programming. | It is used to develop web applications, mobile applications, and windows applications. |
20 | Array Size | An array should be declared with size. For example, int num[10]. | An array should be declared with size. | An array can be declared without declaring the size. For example, int num[]. |