你的问题有点模糊,但可能你想要这个?
for (char c : "this is yahoo answers".toCharArray()) {
System.out.println((int) c);
}
Run Code Online (Sandbox Code Playgroud)
这产生以下结果:
116 104 105 115 32 105 115 32 121 97 104 111 111 32 97 110 115 119 101 114 115
转换char为int将显示其代码点.