Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following table; you are required to discuss thedifferences between

ID: 3611752 • Letter: C

Question

Consider the following table; you are required to discuss thedifferences between C++ and JAVA with respect to givenpoints.                                                                                                                    

                                                                                            

C++

JAVA

Scope resolution operator

Calling static Data members and functions

Automatic type conversions

Conditional expression evaluation.

Namespace issue.

Destructors

Virtual keyword.

Multiple inheritance

typedefs, defines

preprocessor

C++

JAVA

Scope resolution operator

Calling static Data members and functions

Automatic type conversions

Conditional expression evaluation.

Namespace issue.

Destructors

Virtual keyword.

Multiple inheritance

typedefs, defines

preprocessor

Explanation / Answer

In C++, The :: (scope resolution) operator is used to qualifyhidden names so that you can still use them.

Where as There’s No scope resolution operator :: in Java.Java uses the dot for everything but can get away with it since youcan define elements only within a class.

Calling static Data members andfunctions

In C++, static data members and functions are called using thename of the class and the name of the static member connected bythe scope resolution operator.

Where as In Java, the dot is used for this purpose.

Automatic type conversions:

Java does not support automatic type conversions(except where guaranteed safe).

Where as C++ supports.

Conditional expression evaluation:

Conditional expressions in Java must evaluate to boolean ratherthan to integer, as is the case in C++. Statements such asif(x+y)... are not allowed in Java because the conditionalexpression doesn't evaluate to a boolean.

Namespace issue:

The "namespace" issues prevalent in C++ are handled in Java byincluding everything in a class, and collecting classes intopackages.

While Java does not support multiple inheritance, singleinheritance in Java is similar to C++, but the manner in which youimplement inheritance differs significantly, especially withrespect to the use of constructors in the inheritance chain.