This is the second half of the two-part series on the syntactic comparison of Java and C/C++. Before we begin, I’d like to encourage you to read its first part if by any chance you’ve missed it. It is called “Syntactic Comparison of Java and C/C++” and it’s published right here. You shouldn’t miss it because grasping the basics is crucial.
As I promised, I won’t finish this two-part series without enumerating a few of the features that are missing from Java but present in C. Dozens of features were intentionally “left out” from Java. Let’s name a few: structs, unions, friend functions, and so forth. There are well-rationalized reasons for not implementing these.
Needless to say, in most cases there are other, better ways to accomplish the same algorithmic requirements that are safer and more robust. Java focuses mostly on maintaining portability and enhanced security. Therefore, many of the features that allowed programmers to create “havoc” either by mistake or design were removed.
Hopefully I’ve pointed out enough distinctions between Java and C/C++ for you to get excited about. It certainly isn’t a hard language; many experienced coders or even newcomers have a positive attitude toward Java — some go so far as to cheer “It’s fun!”
If you currently have experience with C and/or C++ then picking up Java won’t be hard. All you need to do is actually get familiar with its particular class-like inner workings and practice — a lot! Within a few days you could find yourself porting your favorite source codes into Java just for the sake of it.
Java, as a programming language, was created to help programmers. Its main purpose therefore is to assist programmers to code with ease while maintaining a very high level of portability. As a result, Java is a very powerful and useful language.
Nevertheless, it is not suited for all kinds of applications. We shouldn’t forget that Java is half-interpreted. Moreover, coding something in Java does not always result in an efficient way of programming that specific application. With C/C++ you also have more permission to access the system’s resources (i.e., direct memory access) and significantly faster execution speed. By no means should C++ be tossed out or forgotten.
Java is not a replacement or one-does-it-all programming language. It’s really useful to be familiar with it and use it for well-thought-out specific purposes; it also looks good on a resume or CV. From time to time you might run into projects that would work more efficiently when coded in C++; these are the cases when you should leave Java alone. Forcing a particular language on a project it does not fit won’t work well at all.
With these things said, I am now ending this series. I truly believe that you could extract valuable information from it; that would mean it has served its purpose well.