Java has a particular way of writing variable names. This is
called Java-style. Style refers to something that is
recommended, but not required in Java. In other words, the compiler
won't complain if you break style rules. However, other programmers
may think you're using "bad" style.
For variable names, Java has the following recommended style.
- Don't use underscore or dollar sign in variable names.
- Use lowercase letters for variable names.
- If a variable name has several words, such as
numOrangesInBox, capitalize the first letter of
the second, third, etc. word. Don't capitalize the first
letter of the first word.
- If you want to use digits, use digits at the end,
such as student123.
There is another popular style, but it's most often seen in
C programming. In C, you don't use uppercase at all, and separate
words using underscores. Thus, you would write num_oranges_in_box.
However, it's so common to see Java style used for Java code, that
you're better off leaving not using this style, or leaving it for C
programming.