阅读下列Java程序和程序说明,将应填入(n)处的字句写在对应栏内。【说明】StringEditor类的功能是:已

12 查阅

阅读下列Java程序和程序说明,将应填入(n)处的字句写在对应栏内。

【说明】StringEditor类的功能是:已知一个字符串,返回将字符串中的非字母字符都删除后的字符串。

public (1) {

public static String removeNonLetters( (2) ){

StringBuffer aBuffer=(3);

char aCharacter;

for(int i=0; i<original.length();i++){

aCharacter=(4);

if(Character.isLetter(aCharacter))

aBuffer.append( (5) );

}

return new String(aBuffer);

}

}

public class StringEditorTester{

public static void main(String args[]){

String riginal="Hi!, My Name is Mark, 234I think you are my classmate?!!";

System.out.println(StringEditor.removeNonLetters(original));

}

}

参考答案:

(1)class StringEditor(2)String original(3)new StringBuffer(original.length())(4)original.charAt(i)(5)new Character(aCharacter)(1)class StringEditor(2)String original(3)new StringBuffer(original.length())(4)original.charAt(i)(5)new Character(aCharacter) 解析

软考中级