Names
In addition to the requirement that a class name exactly match the name of the .java file, there are three things to bear in mind about naming classes, interfaces, variables, and methods.
Avoid names that are the same as keywords. So, for example, do not use default as the name of anything, because default is a Java keyword.
By convention, class and interface names begin with a capital letter. Variables that serve as constants are all capitals with underscores between words. A capital letter starts each word in the name of the class, interface, method, or variable. Everything else begins with a lowercase letter.
A variable may start with a letter, an underscore, or a $.
Listing 3.2 shows examples of these rules and conventions.
Code Listing ...
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