Anything that starts with a letter and consists of just letters and digits can be used as an identifier (name of a variable, method, or class).


Every sequence of letters and digits starting with a letter can be used as an identifier


Some character sequences are reserved for use as keywords and cannot be used as identifiers

Here is what's right.

Java has some keywords (e.g., new, return, if, int) and some literals (true, false, and null) that are reserved and cannot be used by a programmer as identifiers. That means it is not possible to use these words to name variables, methods, or classes.

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.