|
|

This is only a preview of the paper Click here to register and get the full text. Existing members click here to login
|
|
|
OBJECT-ORIENTATION
The programs one creates with Java and C++ can be thought of as objects, just as objects exist in the real world. ...
Unlike Java, C++ is based on a hybrid approach to using both procedural and object-oriented methods. Java is the first pure object-oriented program offering a more dynamic, powerful approach to coding. In Java, everything is built on classes except the basic numeric and boolean types and provides object wrappers for those. Numbers, characters, and boolean values are crucial elements in both Java and C++. C++ utilizes stand-alone data and functions for these instances, whereas Java eliminates that. The only two main tasks of Java programming are to create objects and send messages to them.
The functionality of object-orientation in Java is an extension of C++, even though the concepts are fundamentally the same between the two languages . ... Unlike C++, Java supports polymorphism automatically . ... Computers running on Java automatically create a virtual method each time a method is overridden. Also, Java allows a class to inherit the properties of an existing class with inheritance. Essentially, C++ does the same thing with multiple inheritances . But in Java, no class can have more than one parent class. Java directly supports interfaces, rather than using the pure virtual mechanism in C++. ... Unlike using multiple classes in C++, multiple interfaces can be inherited in a single class with Java.
PRIMITIVES
The primitives in Java are basically the ideals of C++. There are two data types in Java, primitive types and reference types, whereas C++ has several type categories. ...
Primitive data members work differently in C++ and Java. Also in Java, with the class definitions one has the ability to initialize primitive data members. ... To my surprise, the data members are also automatically initialized to zero if they aren’t manually initialized in Java. With C++, if you don’t specifically initialize primitive type variables, they’ll contain garbage. Primitive data members of a class can’t be initialized in a class definition with C++, but local primitive type variables can potentially be initialized when they’re declared.
More specifically, all nonprimitive types are objects in Java, and are titled reference types because they pass by reference, or by object handles. In C++, there are structures, unions, enums, arrays, and other stand-alone data structures. All numeric types in Java are signed, whereas they can be signed or unsigned in C++. Boolean data types are primitive requiring them to be true or false, instead of having no explicit Boolean data type in C++. ... Also, Java makes use of 16-bit Unicode characters and C++ uses 8-bit ASCII characters.
ROBUST
Java is generally more robust than C++ for several reasons. ...
Java emphasizes early error checking to prevent possible problems, dynamic runtime checking, and avoiding erroneous situations; Java creates a robust runtime environment for all of its programs.
Approximate Word count = 2283 Approximate Pages = 9.1 (250 words per page double spaced)
|
|
|
|
|
|