Java Language Oracle Official Code Standard


Oracle official style guide for the Java Programming Language is a standard followed by developers at Oracle and recommended to be followed by any other Java developer. It covers filenames, file organization, indentation, comments, declarations, statements, white space, naming conventions, programming practices and includes a code example.


  • The examples above strictly follow the new official style guide from Oracle. They are in other words not subjectively made up by the authors of this page.

  • The official style guide has been carefully written to be backward compatible with the original style guide and the majority of code out in the wild.

  • The official style guide has been peer reviewed by among others, Brian Goetz (Java Language Architect) and Mark Reinhold (Chief Architect of the Java Platform).

  • The examples are non-normative; While they intend to illustrate correct way of formatting the code, there may be other ways to correctly format the code. This is a general principle: There may be several ways to format the code, all adhering to the official guidelines.