Diff between C++ and java?

Answer Posted / blue arkos

Java is interpreted. This means that java source code is
compiled once, but it has to be interpreted by the JVM (Java
Virtual Machine) everytime the programme is executed. On the
other hand, C++ is not. C++ source code will compile once,
but it is NOT interpreted everytime the programme runs,
because C++ code is converted directly to machine language
instructions (in the machine that the C++ programme was
compiled). This is the reason why C++ is NOT portable.

Java is portable. This means that any Java programme can be
executed in any machine, provided that it has a JVM. C++
applications can only be executed in the machine in which
they were created (or in some cases, in similar machines
e.g. a C++ application that was writen in a computer under
the Windows XP Operating System, it will probably run in
other computers with Windows XP and maybe in computers with
other Windows versions, but certainly not in a cell phone).

That's why Java programmes are slower. They have to be
interpreted at runtime and this yields some overhead. This
is the efficiency - portability trade-off. Java applications
are portable, but C++ applications are executed faster.

Finally, there are some ways to overcome this trade-off from
both languages' point of view, but this is not the subject
of the question.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the public class modifier?

500


What is the independent variable in an experiment?

546


Does string is thread-safe in java?

588


How to perform bubble sort in java?

586


Implement two stacks using a single array.

568






What is getkey () in java?

570


What is the use of protected in java?

532


Do you know how to reverse string in java?

581


Variable of the boolean type is automatically initialized as?

593


Can we use synchronized block for primitives?

602


What is use of set in java?

488


What are the main uses of java?

523


How many bytes is a url?

559


make a method which any number and any type of argument and print sum of that arguments.....

1375


What are actual parameters?

519