//: ListCharacters.java
// Demonstrates "for" loop by listing
// all the ASCII characters.public class ListCharacters {
public static void main(String[] args) {
for( char c = 0; c < 128; c++)
if (c != 26 ) // ANSI Clear screen
System.out.println(
"value: " + (int)c +
" character: " + c);
}
} ///:~
帮忙看看输出是什么,谢谢
// Demonstrates "for" loop by listing
// all the ASCII characters.public class ListCharacters {
public static void main(String[] args) {
for( char c = 0; c < 128; c++)
if (c != 26 ) // ANSI Clear screen
System.out.println(
"value: " + (int)c +
" character: " + c);
}
} ///:~
帮忙看看输出是什么,谢谢
"value: " + (int)c +
" character: " + c);
吗
" character: " + c);打印字符的ASC码和该字符,(int)是强制转换成整型
格式为:value: (asc)character: (字符)
格式为:
value: xx character: c
当然如果碰到不可见字符,可能有不可预知的后果,比如换行符是出现一个空行,beep是让喇叭滴一声