第一处错误是Line 28结尾处的分号。
第二处错误是Line 33中:
last.toUpperCase()
toUpperCase Method后的括号。
实际上,排除以上两个错误后,运行时,还出现了另一个编译报错:
java.lang.StringIndexOutOfBoundsException
这是由于,
String.substring();
这个方法使用不当,或使用方法的改变。
以下是此方法的两种使用方法:
Lab1 Source Code中:
String.substring(Beginning Index, Length);
Java API Doc中(SE 8):
String.substring(Beginning Index, End Index);