Java syntax

A snippet of Java code with keywords highlighted in bold blue font

The syntax of Java is the set of rules defining how a Java program is written and interpreted.

The syntax is mostly derived from C and C++. Unlike in C++, in Java there are no global functions or variables, but there are data members which are also regarded as global variables. All code belongs to classes and all values are objects. The only exception is the primitive types, which are not considered to be objects for performance reasons (though can be automatically converted to objects and vice versa via autoboxing). Some features like operator overloading or unsigned integer types are omitted to simplify the language and to avoid possible programming mistakes.

The Java syntax has been gradually extended in the course of numerous major JDK releases, and now supports capabilities such as generic programming and function literals (called lambda expressions in Java). Since 2017, a new JDK version is released twice a year, with each release bringing incremental improvements to the language.


© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search