Table of contents
By using standard Java naming conventions, you make your code easier to read for yourself and other programmers. Naming conventions in Java are a set of guidelines and conventions that developers follow when naming various elements in their Java code, such as classes, methods, variables, and packages.
Camel Case in Java naming conventions
Java follows the camel-case syntax for naming the class, interface, method, and variable.
Examples: CustomerService
, LinkedList
, EmployeeDetails
Package names should be in lowercase letters. Use a reverse domain name as a prefix to ensure uniqueness (e.g., com.example.myapp
). Keep package names short and meaningful.
Boolean variable names should typically start with "is," "has," "can," or similar prefixes to indicate that they represent a boolean value.
Example: isValid
, isFinished
, hasPermission