January 08, 2010

Difference between C++ and Java

The main difference between c++ and java is that java is consistent and it is a dynamic model.it is compact and portable binary code while c++ is not. and most important difference is the it has safe and secure execution environment.
The main purpose to developed java language is that "TO MAKE UNIQUE COMPILER".
java have unique compiler and c++ have savral compiler.
C++                                                                                    java


pointers                                                                            no pointers
multiple inheritance                                                           multiple inheritence with interface
platform dependent                                                          plotformindependent
goto keyword.                                                                 doesnot contain goto keyword.


enum, struct,union                                                            doesn't contain any data types such as
                                                                                       enum, struct,union.
predessor                                                                        does not support predessor
operatoroverloading                                                        does not support operator
                                                                                       overloading(using multithreading capability)


Brifly:
The techniques which are not supported in java nut supported by c++ are...
POINTERS
STRUCTURES
OPERATOR OVERLOADING
MULTIPLE INHERITANCE
GOTO OPERATOR
AUTOMATIC TYPE CONVERSION
DESTRUCTOR
UNSIGNED INTEGER


Feature C C++ Java
Paradigms Procedural Procedural, OOP, Generic Programming OOP, Generic Programming (from Java 5)
Form of Compiled Source Code Executable Native Code Executable Native Code Java bytecode
Memory management Manual Manual Managed, using a garbage collector
Pointers Yes, very commonly used. Yes, very commonly used, but some form of references available too. No pointers; references are used instead.
Preprocessor Yes Yes No
String Type Character arrays Character arrays,  objects Objects
Complex Data Types Structures, unions Structures, unions, classes Classes
Inheritance N/A Multiple class inheritance Single class inheritance, multiple interface implementation
Operator Overloading N/A Yes No
Automatic coercions Yes, with warnings if loss could occur Yes, with warnings if loss could occur Not at all if loss could occur; msut cast explicitly
Variadic Parameters Yes Yes No
Goto Statement Yes Yes No

No comments:

Post a Comment

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

My Favorite Site's List

#update below script more than 500 posts