Naming Your Variables
Variable names in Java can begin with a letter, underscore character (_), or a dollar sign ($). The rest of the name can be any letters or numbers. You can give your variables any names you like but should be consistent in how you name variables. This section outlines the generally recommended naming method for variables.
Java is case-sensitive when it comes to variable names, so you must always capitalize variable names the same way. For example, if the gameOver variable is referred to as GameOver somewhere in the program, an error prevents the program from being compiled.
A variable’s name should describe its purpose in some way. The first letter should be lowercase, and if the variable name has more than one word, make ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access