java slide2 by prabhunathan

VIEWS: 6 PAGES: 5

									Difference between C++ and JAVA
• Compatible with C      • No backward
  source code, except      compatibility with any
  for a few corner cases   previous language
• Write once compile     • Write once run
  anywhere (WOCA)          anywhere /
                           everywhere (WORA /
                           WORE)
• Allows procedural      • Strongly encourages
  programming, object-     an object oriented
  oriented programming     programming
                           paradigm
• Optional automated       • Normally performs
  bounds checking            bounds checking
• Standardized             • Standardized limits
  minimum limits for all     and sizes of all
  numerical types, but       primitive types on all
  the actual sizes are       platforms.
  implementation-
  defined.
                           • No pointers and
• Pointers and               references
  References are
  supported
• Explicit memory         • Automatic garbage
  management, though        collection (can be
  third party               triggered manually).
  frameworks exist to       Doesn't have the
  provide garbage           concept of Destructor
  collection. Supports
  destructors.            • Supports only class
• Supports class, struct,   and allocates them on
  and union and can         the heap.
  allocate them on heap • The meaning of
  or stack                  operators is generally
• Operator overloading      immutable, however
  for most operators        the + and +=
                            operators have been
                            overloaded for Strings.
• Full multiple          • multiple from
  inheritance              interfaces.

• No standard inline     • Javadoc standard
  documentation            documentation
  mechanism. 3rd party
  software exists.
• const keyword for      • final keyword
  defining immutable       provides a limited
  variables and            version of const. No
  member functions         const member
  that do not change       functions
  the object.
• Supports the goto         • No support of goto.
  statement.

• Source code can be        • Is compiled into byte
  written to take             code for the JVM. Is
  advantage of platform       dependent on the
  specific features. Is       Java platform but the
  typically compiled into     source code is
  native machine code.        typically written not to
                              be dependent on
                              operating system
                              specific features

								
To top