codice:
import java.util.*;
public class TestKeyword {
private static String[] keywords = {
"assert", "abstract", "boolean", "break", "byte",
"case", "catch", "char", "class","const", "continue",
"default", "do", "double", "else", "extends", "final",
"finally", "float", "for", "goto", "if", "implements",
"import", "instanceof", "int", "interface", "long",
"native", "new", "package", "private", "protected",
"public", "return", "short", "static", "super",
"switch", "synchronized", "this", "throw", "throws",
"transient", "try", "void", "volatile", "while"};
public static void main(String[] args) {
System.out.println("La parola " +
((Arrays.binarySearch(keywords, args[0]) >= 0) ? "è" : "non è") +
" una keyword");
}
}