Wednesday, May 25, 2011

C++ Vs JAVA feature Comparision

Difference between C++ and Java, C++ Vs JAVA
To find the differences between C++ and Java programming languages we must know the goals for designing them.
Basically, C++ was designed for systems and applications programming, extending the C programming language.
Whereas, Java was created initially as an interpreter for printing systems but grew to support network computing.
So lets compare the C++ and JAVA feature wise,

C++ JAVA
Except for a few corner cases its
compatible with C source code.
No backward compatibility with any
previous language. Although the syntax is strongly influenced by C/C++,
but not compatible with C.
Platform dependent Platform independent, write once, run
everywhere.
Allows generic programming, procedural
programming and object-oriented programming
Encourages OOPS concept, object
oriented programming paradigm.
Its allows direct calls to native system
libraries.
Call through the Java Native Interface and
recently Java Native Access.
Exposes low-level system facilities. Runs in a protected virtual machine.
Only type names and object types are
provided
Allow meta programming and dynamic code
generation at runtime.
Has multiple binary compatibility
standards (commonly Microsoft and Itanium/GNU)
Has a binary compatibility standard,
allowing runtime check of correctness of libraries.
Support Pointers, References and pass by
value
Here, Primitive and reference data types
always passed by value only
Memory management explicitly, however
third party frameworks exist to provide garbage collection and supports
destructors.
Here, automatic garbage collection also
can be triggered manually. Java doesn't have concept of Destructor,
finalize() can be used but not recommended.
Supports struct, class and union, then it
can allocate them on stack or heap
Java supports only class and allocates
them on the heap. However Java 6 optimizes with escape analysis to
allocate some objects on the stack.
Allows overriding type explicitly Rigid type safety except for widening
conversions. Autoboxing/Unboxing added in Java 1.5.
Support operator overloading for most
operators.
The meaning of operators is generally
immutable, however the + and += operators have been overloaded for
Strings.
Support full multiple inheritance,
including virtual inheritance.
Only one inheritance from classes,
interfaces support multiple inheritance
Don't have standard inline documentation
mechanism. However  3rd party software like  Doxygen exists.
Provide Javadoc standard documentation.
Provide const keyword to define immutable
variables and member functions that do not change the object
Provide 'final' which is a limited version
of const, equivalent to type* const pointers for objects and plain const
of primitive types only. No const member functions, nor any equivalent
to const type* pointers.
Supports the goto statement. Supports labels with loops and statement
blocks.

1 comment:

  1. it's good to see this information in your post, i was looking the same but there was not any proper resource, thanx now i have the link which i was looking for my research.
    source: www.wbupdates.com

    ReplyDelete