如何把一個字符串分解成單個字符如何把一個字符串分解成單個字符如何把一個字符串分解成單個字符如何把一個字符串分解成單個字符如何把一個字符串分解成單個字符如何把一個字符串分解成單個字符如何把一個字符串分解成單個字符如何把一個字符串分解成單個字符
2 回答

汪汪一只貓
TA貢獻1898條經驗 獲得超8個贊
public static void main(String[] args) {
String str="abcdefg";
char [] c=str.toCharArray();
for(char ch:c)//for-each循環輸出每一個字符并且以\t分割開來
{
System.out.print(ch+"\t");
}
}
- 2 回答
- 0 關注
- 1009 瀏覽
添加回答
舉報
0/150
提交
取消