Pin It

Java Vs C++ difference and comparisons

Comparison and Difference between Java and C++

Before advent of Java, C++ was very popular and most widely used object oriented programming language. Bjarne Stroustrup developed C++ in the year 1979. Java when comes to syntax, it is quite similar to C++. Java and C++ has many major differences. Java left out C++ complex concepts, modified and added new. 

Let us examine few of major differences between the two :-
1.  Java is pure object oriented programming language, while C++ supports both procedural and object oriented approach.
2.  Java does not support multiple inheritance, while C++ supports multiple inheritance.
3.  Java does not support operator overloading, while C++ supports operator overloading.
4.  In Java, methods are part of the class, while C++ has stand alone methods which are not part of class.
5.  In Java, objects are passed to methods only by reference, while in C++, objects can be passed to functions by value or reference.
6.  Java doesn’t support pointer mechanism, while C++ uses pointers extensively.
7.  In Java, Strings are objects, while in C++, Strings are null-terminated character arrays.
8.  Java has built in string concatenation operator, while in C++ all string operations are performed using functions.
9.  Java doesn’t support Templates, while C++ supports Templates for parameterized type.
10.    Java doesn’t support default arguments, while in C++ functions can take default arguments.
11.    In Java, methods are dynamically bound, while in C++ only virtual functions are dynamically bound.
12.    In Java, array lengths in multidimension can vary from one element to the next within one dimension, while in C++ multidimensional arrays lengths are of same sizes.
13.    In Java, there is bound checking on the arrays, while in C++ there is no bound checking.
14.    Java supports automatic garbage collection, while in C++ there is no automatic garbage collection.
15.    Java is a compiled and interpreted language, while C++ is a compiled language.
16.    Java has no functionality of structures and unions, while C++ has structures and union.
17.    Java doesn’t supports forward referencing, while C++ supports explicit forward referencing.
18.    No typedef in Java, while C++ supports typedef.
19.    Java provides documentation comments which is missing in C++.
20.    In Java, main method doesn’t return any value, while in C++ it can return values.
21.    Java supports labels on break and continue statements, while in C++ there is no label functionality.
22.    Java is architectural neutral programming language, while C++ is specific to particular architecture.
23.    Java supports interfaces which is missing in C++.
24.    Java supports multithreading which is missing in C++.
25.    No preprocessor is required in Java, while C++ rely on preprocessor.
26.    In Java, program name is not included for command-line arguments, while C++ includes the program name.
27.    Java supports web based applications such as JSP, servlets and applets, while C++ lacks such feature.
28.    Java supports distributed applications such as RMI and sockets, while C++ lacks this functionality.
29.    Java also supports network protocols such as TCP/IP and HTTP, while C++ lacks those supports.
Please Give Us Your 1 Minute In Sharing This Post!
Related Posts Plugin for WordPress, Blogger...

Post your related queries below ...

comments powered by Disqus
Powered by Blogger.
© 2012 Learn Java by Examples Template by Hubber Spot