Class Names and Identifiers

By convention, class names begin with a capital letter and capitalize the first letter of each word they include (e.g., SampleClassName). A class name is an identifier—a series of characters consisting of letters, digits, underscores (_) and dollar signs ($) that does not begin with a digit and does not contain spaces. The name 7button is not a valid identifier because it begins with a digit, and the name input field is not a valid identifier because it contains a space. Java is case sensitive—uppercase and lowercase letters are distinct—so value and Value are different identifiers.

In Appendices A–E, every class we define begins with the keyword public. For our application, the file name is Welcome1.java.

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.