Even though both C++ and Java are Object oriented language, they have many differences. Both languages have their own design goals. C++ designed for application and system development but java is developed to provide secure and portable language. The main difference is java is platform independent and C++ is platform dependent. Some of the differences are listed below,
Top 9 differences between C++ and Java are listed below,
|1||Object-Oriented||Not a purely object oriented programming language||Java is pure object –oriented programming language.|
|2||Pointers concept||Available||Not available|
|3||Memory allocation||Programmer responsibility||Taken care by JVM|
|4||Multiple inheritance||It will supports||Won’t support|
|6||goto statement||It has||It does not have|
|7||Thread||It doesn’t have built-in support for threads||It has built-in support for threads|
|8||structures or unions||It has||It does not have|
|9||Exception handling||We can exclude the attempt to handle exception even though function through an exception.||Try/catch must define if functions may throws an exception|
Top 5 interview question
- Why pointer is eliminated in java compare to C++?
- Why java platform independent compare to C++?
- What are the difference between Java and C++?
- What are the similarities between Java and C++?
- Why memory and exceptions are handled in Java and C++?