问答题

编程判断指定的字符串是否是合法的 Java 标识符?请在空白处 填上适当的语句。 public class Identifier { public static boolean isIdentifier(String str) { if (str!=null && str.length()>0) { char ch = str.charAt(0); if ( if(ch>='A'&&ch<='Z') ) { for (int i=1; i ='A' && ch='a' && ch='0' && ch0) str=args[0]; System.out.println("\""+str+"\"isIdentifier?"+isIdentifier(str)); }

【参考答案】

return false; return true;