Chapter 5. Differences and Similarities between C++ and Java

Table of Contents

Introduction
The General Language
Data Types
Comments
Memory management
No Pointers
Global Functions
Strings
Arrays
Method Parameters
OOP Concepts in C++ and Java
Similar Constructors
No Destructors!
Access Specifiers
Access Specifiers when Inheriting Classes
Virtual and Non-Virtual Methods
Multiple Inheritance
No scope resolution operator
Nested Classes
Inline Methods
The Compiler
General Compiler issues
Libraries
Exceptions
Default Arguments
No Preprocessor
Multithreading

Introduction

 

"Claiming Java is easier than C++ is like saying that K2 is shorter than Everest."

 
 --Larry O'Brien (editor, Software Development)

Now that we have covered C++ in some detail, discussing concepts of object-oriented programming as applied to C++, it makes sense to discuss the similarites and differences between C++ as we have used it so far, and Java as we have begun to use it. The good news is that there are enought similarities between the languages to allow a programmer to have a choice to use the correct language for the application to be developed, without having to enter a whole new thought process.