English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Pour afficher les caractères imprimables, vous devez utiliser32à127entre les valeurs ASCII.
Ainsi, nous utilisons ce contenu plutôt que System.out.println()
System.out.write();
Voici affichés tous les caractères imprimables.
for (int i = 32; i < 127; i++) { System.out.write(i);
Voici un exemple complet.
public class Demo { public static void main(String []args) { System.out.println("Caractères imprimables..."); 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'); } }
Résultat de la sortie
Caractères imprimables... !"#$%&' ()*+,-./ 01234567 89:;<=>? @ABCDEFG HIJKLMNO PQRSTUVW XYZ[\]^_ `abcdefg hijklmno pqrstuvw xyz{|}~