Technically, Java entities can be any combination of letters (case sensitive), digits, dollar signs, and underscores. But there are naming conventions. Following these make it easier for future developers reading your code to sort out which names are classes, which are variables, which are methods, and so on.

I have seen these conventions violated in practice, and believe me–it just leads to confusion.

Type of itemConvention
Classes and InterfacesLetters and digits in “upper camel case” with no punctuation, with first letter in uppercase. Examples: HelloWorldClass, Date
Methods and variablesLetters and digits in “lower camel case” with no punctuation, with first letter in lowercase. Examples: expirationDate, lovePotionNumber9
ConstantsLetters and digits all in uppercase, with underscores (“_”) between words. Examples: ERROR_MESSAGE_01, INDEPENDENCE_DAY.
PackagesLowercase letters with levels (i.e. subdirectory names) separated by periods. Example: org.hardknockjava.lesson02.

“Camel case” is the name for a string of concatenated words, all in lowercase except for the first letter of each word. In “upper camel case,” the first letter of the string is in uppercase; in “lower camel case,” the first letter of the string is in (would you believe?) lowercase.

And now, it’s time to learn more about classes and interfaces. On to Lesson 3!