Java charAt() 方法
charAt() 方法用於返回指定索引處的字符。 索引範圍為從0 到length() - 1。
語法
public char charAt(int index)
參數
index --字符的索引。
返回值
返回指定索引處的字符。
實例
public class Test { public static void main(String args[]) { String s = "www.w3big.com"; char result = s.charAt(8); System.out.println(result); } }
以上程序執行結果為:
o