English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
لعرض الحروف القابلة للطباعة، تحتاج إلى استخدام قيم ASCII بين 32 و 127.
بهذا، نستخدم ما يلي بدلاً من System.out.println()
System.out.write();
ما يلي يظهر جميع الحروف القابلة للطباعة.
for (int i = 32; i < 127; i++) { System.out.write(i);
لننظر إلى مثال كامل.
public class Demo { public static void main(String []args) { System.out.println("Printable characters..."); for (int i = 32; i < 127; i++) { System.out.write(i); if (i % 8 == 7) System.out.write('\n'); else System.out.write('\t'); } System.out.write('\n'); } }
نتيجة ال输出来
حروف قابلة للطباعة... !"#$%&' ()*+,-./ 01234567 89:;<=>? @ABCDEFG HIJKLMNO PQRSTUVW XYZ[\]^_ `abcdefg hijklmno pqrstuvw xyz{|}~