Java vs. C++
The assumption in CSCI221 is that you have prior experience programming with Java. This should mean you have seen virtually all the features of the Java language that appear on this page. We will learn the basics of C++ by looking at the similarities and differences with Java.
Also consider:
A note about completeness
Some techniques not mentioned here, e.g.,
if’s,
for loops, math
operations like
+,
-,
%, etc., work the same in Java and C++.
Hello World
Compiling, running
Primitive data types
String functions
In both languages, strings are arrays of
char’s. The
String class
is built into Java, so you don’t need to do anything special to use
it. In C++, you must write
#include <string> at the top of your
file. Note that
String is capitalized in Java (like all Java
classes), while in C++ it is not.