(String[] args)
| 5 | */ |
| 6 | public class StringTest { |
| 7 | public static void main(String[] args) { |
| 8 | String s = "java"; |
| 9 | |
| 10 | // ͨ��charAt()�������λ�ȡ�ַ� |
| 11 | // System.out.println(s.charAt(0)); |
| 12 | // System.out.println(s.charAt(1)); |
| 13 | // System.out.println(s.charAt(2)); |
| 14 | // System.out.println(s.charAt(3)); |
| 15 | |
| 16 | // ���ǣ�����ַ����ĸ����Ƚ϶࣬����ͻ���鷳�������ظ��Ⱥܸ� |
| 17 | // for (int x = 0; x < 4; x++) { |
| 18 | // System.out.println(s.charAt(x)); |
| 19 | // } |
| 20 | |
| 21 | // ����ַ����ݽ϶࣬�������������ԣ�����Ҫ��һ����ȡ�ַ������ķ��� |
| 22 | // length(); |
| 23 | for (int x = 0; x < s.length(); x++) { |
| 24 | // System.out.println(s.charAt(x)); |
| 25 | |
| 26 | char ch = s.charAt(x); |
| 27 | System.out.println(ch); |
| 28 | } |
| 29 | } |
| 30 | } |
nothing calls this directly
no outgoing calls
no test coverage detected