By Barry Burd

The Java language uses two kinds of words: keywords and identifiers. You can tell which words are keywords because Java has only 50 of them. Here’s the complete list:

abstract continue for new     switch    
assert default goto package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while

As a rule, a keyword is a word whose meaning never changes (from one Java program to another). For example, in English, you can’t change the meaning of the word if. It doesn’t make sense to say, “I think that I shall never if / A poem lovely as a riff.”

The same concept holds true in a Java program: You can type if (x > 5) to mean “If x is greater than 5,” but when you type if (x > if), the computer complains that the code doesn’t make sense.

In this listing, the words package, public, class, static, and void are keywords. Almost every other word in that listing is an identifier, which is generally a name for something. The identifiers in the listing include the package name org.allyourcode.myfirstproject, the class name MyFirstJavaClass, and a bunch of other words.

package org.allyourcode.myfirstproject;
public class MyFirstJavaClass {
   * @param args
  public static void main(String[] args) {
                                   (null, "Hello");

In programming lingo, words such as Wednesday, Barry, and university in the following sentence are identifiers, and the other words (If, its, is, and at) are keywords:

If it’s Wednesday, Barry is at the university.

As in English and most other spoken languages, the names of items are reusable. For example, a recent web search turns up four people in the United States named Barry Burd (with the same uncommon spelling). You can even reuse well-known names. (A student at Temple University had the name John Wayne, and in the 1980s two different textbooks were named Pascalgorithms.)

The Android API has a prewritten class named Activity, but that doesn’t stop you from defining another meaning for the name Activity.

Of course, having duplicate names can lead to trouble, so intentionally reusing a well-known name is generally a bad idea. (If you create your own thing named Activity, you’ll find it difficult to refer to the prewritten Activity class in Android.