← Back to Week 1 Hub

Java Naming Conventions

Workbook 1c, p.53 — The rules every Java developer follows

abc

Variables & Methods

camelCase
Abc

Classes

PascalCase
a.b.c

Packages

all.lowercase
A_B

Constants

UPPER_SNAKE_CASE
Good vs Bad Examples
Variable
FirstName
firstName
Class
bankAccount
BankAccount
Method
GetTotal()
getTotal()
Package
Com.MyApp
com.myapp
Constant
maxSize
MAX_SIZE
Variable
student_age
studentAge
Fix the Name — Quiz
Tip: Java compiles fine with "wrong" naming — these are conventions, not compiler rules. But every professional Java developer follows them. Code that breaks naming conventions looks immediately wrong to experienced developers and will be flagged in any code review.

Click an answer in the quiz to check your knowledge

← Final Constants Integer Division →