Tuesday, November 30, 2010

Java and C++ differences

We can classify the object oriented languages as pure object oriented and not pure object oriented languages. For example java is purely object oriented and c++ is not, because java doesn't support procedure oriented programming paradigm and c++ not, so the difference starts there itself, and there is more here.

  1. c++ is not purely object oriented and java is purely object oriented
  2. c++ has pointer  facility so that, can directly access the memory location and java doesn't support pointers
  3. c++ char data type is 8 bit long and for java it is 16 bit
  4. c++ int type is system dependent, i.e. for 16 bit processor it is 16 bit and for 32 bit it is 32 bit and for java it is fixed 32 bit (4 byte)
  5. c++ output is executable machine code so that it can be directly executed by the processor, but java output is byte code which is then executed by the java frame works (i.e java frame work translates it into machine code during run time)
  6. c++ output is faster than java output, it is because the c++ doesn't need any translators during execution/run time, but java output(byte code) need java run time to translate the code to machine code.

Experience note:-
Asked the same question when I attended an interview for the position of java programmer/developer in a software company.

No comments:

Post a Comment