Читать книгу OCP Oracle Certified Professional Java SE 17 Developer Study Guide - Jeanne Boyarsky - Страница 104

camelCase and snake_case

Оглавление

Although you can do crazy things with identifier names, please don't. Java has conventions so that code is readable and consistent. For example, camel case has the first letter of each word capitalized. Method and variable names are typically written in camel case with the first letter lowercase, such as toUpper(). Class and interface names are also written in camel case, with the first letter uppercase, such as ArrayList.

Another style is called snake case. It simply uses an underscore (_) to separate words. Java generally uses uppercase snake case for constants and enum values, such as NUMBER_FLAGS.

The exam will not always follow these conventions to make questions about identifiers trickier. By contrast, questions on other topics generally do follow standard conventions. We recommend you follow these conventions on the job.

OCP Oracle Certified Professional Java SE 17 Developer Study Guide

Подняться наверх