CHAPTER 25

MOVING FROM C++ TO JAVA

Many programmers learn C++ before learning Java. Unwittingly, one starts comparing the two languages. Since both the languages are object oriented and Java has kept the basic syntax of C++, learning Java can be much faster (if not simpler) for C++ programmers.

This section is divided in three parts. In the first part, we will compare keywords in the two languages and the effect thereof. In the second part, we will examine all the differences in the two languages in detail. In the third part, we will show how small- and medium-sized C++ programs can be converted into Java programs.

25.1 Part I: Comparing Keywords

25.1.1 Keywords

Let us start on a positive note. If you know C++, you know the heart of Java. The ...

Get Programming with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.