Java Syntax and Data Types

One of the dictionary definitions of the word syntax is

The pattern of formation of sentences or phrases in a language.“

The syntax of Java is strongly based on that of C++. This was partly because there were so many C and C++ programmers in the world that Sun thought the language would be more likely to catch on if plenty of existing programmers found it easy to learn. However, it does not have the sort of backwards compatibility between C++ and C (any legal C program should be compilable in a C++ compiler). One of the problems with C/C++ is that many important details are "vendor implemented". This means that a feature that will work in one version of a compiler will break in another. This has resulted in situations where MFC (Microsoft Foundation Class), although built on C++ is effectively a whole new language to learn.

One of the goals of Java was that it should make it less likely to write buggy code. No amount of language design will entirely eliminate bugs, but a good design can make bugs less likely. It removes some of the burden from the programmer onto the compiler writers. To this end Java was designed to be simpler than C or C++. Two of the ways that Sun produced a simplified language is the removal of the direct manipulation of pointers and only allowing single inheritance. Direct manipulation of pointer as in the use of the * operator in C/C++ is a major source of bugs in programs. Java does use pointers, but they are hidden behind references and cannot be directly manipulated. If you are from a Visual Basic background this may be meaningless, but for C/C++ programmers it is an interesting departure.

The definitive guide to the syntax of the Java language is the Java Language Specification, which can be browsed at

Last modified: Thursday, 24 July 2014, 2:54 PM