Вы находитесь на странице: 1из 2

CHANDAN MUKHERJEE 26630615 9831125100

__________________MTech (IT), BE (Computer Science), Diploma (Electrical Engg) _________________

Java vs. C++


General programming issues
Java C++
Method bodies must be defined inside the class to Method bodies must be defined inside the
which they belong. class to which they belong.
No forward referencing required. Explicit forward referencing required.
No preprocessor. Heavy reliance on preprocessor.
No comma operator. Comma operator.
No optional method parameters. Optional function parameters.
No const reference parameters. const reference parameters.
No goto goto
Labels on break and continue. No labels on break and continue.
Command-line arguments do not include the program Command-line arguments include the
name but include main class Name. program name.
Main method cannot return a value. Main function can return a value.
No global variables. Global variables.
Character escape sequences can appear in a Character escape sequences must appear
program. in a string or character literal.
Cannot mask identifiers through scope. Can mask identifiers through scope.

Object-oriented programming
Java C++
Hybrid between procedural and object-
Pure object-oriented language.
oriented.
All functions (methods) are part of a class. Can have stand-along functions.
No multiple inheritances. Multiple inheritances.
Formal interface specifications. No formal interface specifications.
Generics as parameterized type. Templates as parameterized type.
No operator overloading. Operator overloading.
All methods (except final methods) are dynamically
Virtual functions are dynamically bound.
bound.

____________________________________________________________________________________ 1
Teaches All major subjects for Engineering (BE) / MCA / BCA / Diploma / AMIE / DOEACC Students.
Project Guide for BE / MCA / BCA / Diploma Students
Address:- 80, Ramlal Dutta Road, P.O- Bhadrakali, Dist:- Hooghly, 712232. Rly Station:- Uttarpara
(Nera Amarendra Vidyapith Boys School)
CHANDAN MUKHERJEE 26630615 9831125100
__________________MTech (IT), BE (Computer Science), Diploma (Electrical Engg) _________________

Primitive Types
Java C++
Two type categories. Various type categories.
Separate types for structs, unions, enums, and
All nonprimitive types are objects.
arrays.
All numeric types are signed. Signed and unsigned numeric types.
All primitive types are a fixed size for all
Primitive type size varies by platform.
platforms.
16-bit Unicode characters. 8-bit ASCII characters.
Integer results are interpreted as Boolean
Conditions must be Boolean expressions.
conditions.

Pointers and Data Structures


Java C++
References, with no explicit pointer Pointers, with dereferencing (* or ->) and address
manipulation and no pointer arithmetic. (&) operators.
Array references are not translated to pointer
Array references translate to pointer arithmetic.
arithmetic.
Arrays automatically check index limits. No automatically array bounds checking.
Array lengths in multidimensional arrays can Array lengths in multidimensional arrays are all
vary from one element to the next within one the same size in a give dimension, fixed by the
dimension. declaration.
Strings are objects. Strings are null-terminated character arrays.
Built-in string concatenation operator(+). String concatenation through a library function.
Use string concatenation operator for long string
Use line continuation (\) for long string literals.
literals.
No typedef. typedef to define types.

Special Characteristics
Java C++
Specifically attuned to network and Web processing. No relationship to networks or the Web.
Automatic garbage collection. No automatic garbage collection.
Combination of compiled and interpreted. Compiled.
Slower execution when interpreted. Fast execution.
Architecture neutral. Architecture specific.
Supports multithreading. No multithreading.

____________________________________________________________________________________ 2
Teaches All major subjects for Engineering (BE) / MCA / BCA / Diploma / AMIE / DOEACC Students.
Project Guide for BE / MCA / BCA / Diploma Students
Address:- 80, Ramlal Dutta Road, P.O- Bhadrakali, Dist:- Hooghly, 712232. Rly Station:- Uttarpara
(Nera Amarendra Vidyapith Boys School)

Вам также может понравиться