Section 1.4 Why Learn Java? Why not C or C++?
It is easier to learn to create interesting programs in Java than in C or C++, for several reasons:
-
Java includes a larger standard library than C or C++, which means that sophisticated programs can be created in Java without including external dependencies. The Java Standard Edition contains thousands of built-in classes that support tasks like file input/output, networking, data structures, and graphical interfaces. We could not begin to scratch the surface of these classes even if we devoted all of class time! However, we will cover many useful and powerful features of the Java standard library this semester.
-
Java incorporates automatic garbage collection of memory, whereas C and C++ programs typically include some degree of manual memory management. This makes programming in those languages more challenging.
-
C++’s syntax is more complicated than Java’s, making it more difficult to learn. For example, C++ supports a feature called operator overloading, which makes it possible to change the behavior of operators like
+. This can make it more difficult to understand what a C++ program is doing.
Certainly, C and C++ are important languages, and are worth learning. But for these and other reasons, we’ve decided to use Java for this course. Learning Java will be a good preparation for learning these and other languages!
You have attempted of activities on this page.
