Why Naming Conventions?
Following standard naming conventions makes your code readable and maintainable by others.
1. Classes and Interfaces
Use
PascalCase (First letter of each word capitalized).
MyClass
Scanner
String
HelloWorld
2. Methods and Variables
Use
camelCase (First letter lowercase, others capitalized).
myMethod()
calculateSum()
myVariable
firstName
3. Constants
Use
SCREAMING_SNAKE_CASE (All uppercase with underscores).
MAX_VALUE
PI
DEFAULT_TIMEOUT
4. Packages
Use
lowercase.
java.util
com.javacompiler.app