In php, one can handle a list of state names and their abbreviations with an associative array like this:
in java for associative array use Map
import java.util.*;
class Foo
{
public static void main(String[] args)
{
Map stateMap = new HashMap();
stateMap.put("ALABAMA", "AL");
stateMap.put("ALASKA", "AK");
// ...
stateMap.put("WYOMING", "WY");
for (Map.Entry state : stateMap.entrySet()) {
System.out.printf(
"The abbreviation for %s is %s%n",
state.getKey(),
state.getValue()
);
}
}
}