预测以下程序的输出。
null
class Test { public static void main(String[] args) { String str = "geeks" ; str.toUpperCase(); str += "forgeeks" ; String string = str.substring( 2 , 13 ); string = string + str.charAt( 4 );; System.out.println(string); } } |
(A) Eksforgekss (B) Eksforgeks (C) Eksforgekss (D) Eksforgeks 答复: (A) 说明: str.toUpperCase()以大写形式返回’str’。但是,它不会更改原始字符串“str”。 str.substring(x,y)返回从位置“x”(包含)到位置“y”(排除)的字符串。 str.charAt(x)返回字符串“str”中位置“x”处的字符。 这个问题的小测验
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END