What are some recommended Java naming conventions

Prof. Dr. Pape - Java Programming Guidelines - Introduction

Most of the programming guidelines dealt with in the lecture Computer Science 1 can be found here in a clear form. Most of them are Programmingbut also some guidelines Draftguidelines. The rules are grouped in such a way that guidelines which apply to the same programming language elements are usually grouped together.

The programming conventions listed here are essentially identical to the Java Code Conventions published by Sun. In my experience, they correspond to what most Java programmers adhere to in practice - at least if programming conventions and a style are recognizable in the Java source code. Note that there are additional guidelines for advanced Java technologies such as Java Server Pages, Servlets and Enterprise Java Beans (see java.sun.com).

Many of the programming guidelines listed here are not Java-specific at all or only for object-oriented programming but apply to all programming languages. Some of the listed conventions are not equally important - I have not marked them accordingly.

Typically, programming guidelines should be very short: around 2-3 pages. If they are longer, then nobody reads them and the rules are not applied at all. This brevity can later be done without hesitation in the programming guidelines of a company: the rules do not need to be justified there and many no longer need to be mentioned, as they (should) become part of the flesh and blood until the end of the computer science training. Since the programming guidelines listed here are intended for the training of computer science students in the first semester, this document contains a corresponding number of rules and detailed explanations. In project practice, it is advisable to enforce these rules with the corresponding functions of the development environment used (warning in the event of non-compliance, automatic formatting).

The short version of a rule is highlighted. The short version is followed by examples and a detailed explanation. Just follow the reference of the rule.

Overview of the Java programming conventions

Java naming conventions


Variables, Attributes and Parameters




Source code formatting






Data types

Local variables