这是我试图弄清楚发生了什么的代码片段
String line = "Hello";
for (int i = 0; i < line.length(); i++) {
char character = line.charAt(i);
int srcX = 0;
if (character == '.') {
}else{
srcX = (character - '0') * 20;
System.out.println("Character is " + (character - '0') +" " + srcX);
}
}
并执行该代码将导致此
Character is 24 480
Character is 53 1060
Character is 60 1200
Character is 60 1200
Character is 63 1260
一个字符减去“0”的字符串如何得到整数?系统的答案在哪里有 24、53、60、60、63?