Friday 11 November 2011

Difference Between C++ and Java


C++ vs Java

Both C++ and Java are high level programming languages which come under 4th Generation languages. Both are Object Oriented Programming Languages. But, They do share some differences between them. Check out the Differences between C++ and Java.

C++

Difference Between C++ and Java
  1. C++ (earliar known as C with Classes) was developed by Bjarne Stroustrup in 1979 at Bell Labs.
  2. C++ make use of Pointers and References
  3. C++ binary is not portable meaning binary cannot be run on different OS Platforms.
  4. C++ supports Multiple Inheretence through usage of Virtual Inheritance.
  5. Dynamic Polymorphism is achieved using Virtual Keyword (use of Virtual Pointer [VPTR] and VTable)
  6. C++ doesn’t support Memory Management. The progammer has to take care of Memory Allocation and Deallocation with the operations like New, Delete, Malloc, Calloc and use of Destructors (virtual destructors in case of virtual inheritance)
  7. C++ uses Collections by using STL (Standard Template Library). Its a third-party API
  8. C++ can have Global functions or Global variables which are outside the class
  9. C++ uses namespaces.

Java

Difference Between C++ and Java
  1. Java was developed by James Gosling in 1995 at Sun Microsystems (now acquired by Oracle Corporation).
  2. Java uses only References. Pointers are eliminated in Java to remove the complexity from the Programmers.
  3. Java code is portable and is achieved using Java Bytecode (.class) file which can be executed by JVM (JVMs differ based on the OS).
  4. Java doesn’t support Multiple Inheretence (because of Daimond Problem), But supportsInterface Inheritance using Interface.
  5. Dynamic Polymorphism is achieved using Method Overiding
  6. Java support Automatic Memory Management using Garbage Collector. The GarbageCollector is a Daemon thread which keeps scanning the memory and clears the objectswhen the memory is low or required.
  7. Java API comes with Collections package.
  8. Java cannot have Global functions or Global variables
  9. Java uses Packages.

Difference Between C and C++


Everybody in the IT world knows about C and C++. Both are Computer LanguagesC and C++. C++ was born after C language, C++ is a super set ofC. Both languages have lots of differences between them. But, I am listing out the 10 Main Difference Between C and C++ languages



Difference Between C and C++

C Language

  1. C Language is not an object oriented language.
  2. C is a procedural programming language.
  3. supports only Structures.
  4. does not have reference variable, only supports pointers.
  5. uses Scanf and Printf for input and output functions.
  6. functions can’t be included in structures.
  7. regarded as a low-level language.
  8. doesn’t support inline functions, instead can be used via #define directive.
  9. uses the top-down approach.
  10. C is function driven.

C++ Language

  1. C Language is a object oriented language (includes 4 OOPs concepts).
  2. C++ is not a procedural programming language.
  3. supports Classes and Objects.
  4. supports both reference and pointer variables.
  5. uses cin>> and cout<< for input and output functions.
  6. functions can be included in structures.
  7. regarded as mix of low-level and high-level language.
  8. supports inline functions.
  9. uses the bottom-up approach.
  10. C++ is Object driven.
admit there can be ‘n’ number of differences, But I have mentioned only the important 

Some links for java Materials

Some Links for C & C++materials