如题 string数组 算一维数组还是二维数组
String[] st = {"abcde","fghij","klmno","pqrst"};
请问哪里有错 得到st[2]里面的其中一个字符怎么得到 谢谢
------解决方案--------------------
这个是一维数组。
- Java code
public class AnsewerTest{ public static void main(String[] args) { String[] st = {"abcde","fghij","klmno","pqrst"}; for(int i=0;i<st[2].length();i++) { System.out.println(st[2].charAt(i)); } }}
------解决方案--------------------
- Java code
public static void main(String[] args) { String[] st = {"abcde","fghij","klmno","pqrst"}; System.out.println(st[2].charAt(0)); System.out.println(st[2].charAt(1)); System.out.println(st[2].charAt(2)); System.out.println(st[2].charAt(3)); System.out.println(st[2].charAt(4)); }