Java vs C++
Java
1. Java is Purely an OOPL. Since it is not possible to write a java program without using at least one
class.
2. We can't create and use pointers in java.
3. Allocation and de-allocation of memory will be taken by JVM.
4. Java does not have goto statement.
5. No multiple inheritance in java but there are means to achive it.
6. Operator overloading is not available in java.
7. #define,typedef and header files are not available in java but there are means to achive them.
8. Java support 4 access specifier private, protected, public and default.
Java Example
class Simple{
public static void main(String args[]){
System.out.println("Hii.. Java");
}
}
C++
1. C++ is not Purely an OOPL. Since it is possible to write a C++ program without using a class.
2. We can create and use pointers in C++.
3. Allocation and de-allocation of memory is the responsibility of the programmer.
4. C++ has goto statement.
5. multiple inheritance features is available in C++.
6. Operator overloading is available in C++.
7. #define,typedef and header files are available in C++.
8. C++ support 3 access specifier private, protected and public.
C++ Example
#include <iostream>
using namespace std;
int main(){
cout << "Hii.. C++";
return 0;