String charAt() Method in Java with Example.
例
现场演示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import java.lang.*; public class StringDemo { public static void main(String[] args) { String str ="This is tutorialspoint"; // prints character at 1st location System.out.println(str.charAt(0)); // prints character at 5th location i.e white-space character System.out.println(str.charAt(4)); // prints character at 18th location System.out.println(str.charAt(17)); } } |