//KeyWord.java原代码
package wordanalyse;
public class KeyWord {
private static final String[] keyWords={"auto","break","case","char","const","continue","default","do","double",
"else","enum","extern","float","for","goto","if","int","long","register",
"return","short","signed","sizeof","static","struct","switch","typedef",
"union","unsigned","void","volatile","while","include","define"}; /*C语言所有关键字,共32个*/;
public KeyWord()
{
}
public static boolean isKeyWord(String checkedWord)
{
for(int i=0;i<keyWords.length;i++)
if(keyWords[i].equals(checkedWord))
return true;
return false;
}
/*public static void main(String[] args)
{
if(KeyWord .isKeyWord("goto1"))
System.out.println("关键词!");
else System.out.println("这个单词不是关键词!");
}*/
}