1 // CharLiteral.java
2
3 /** 4 * CharLiteral zeigt die Ausgabe von Zeichenliteralen auf der Konsole. 5 * Beispielprogramm zur Programmiertechnik 1, Teil 2. 6 * @author H.Drachenfels 7 * @version 7.1.2019 8 */
9 public final class CharLiteral {
10 private CharLiteral() { }
11
12 /** 13 * main ist der Startpunkt des Programms. 14 * @param args wird nicht verwendet. 15 */
16 public static void main(String[] args) {
17 System.out.print('H');
18 System.out.print('a');
19 System.out.print('l');
20 System.out.print('l');
21 System.out.print('o');
22 System.out.print('\n');
23 System.out.print("Hallo\12"); // Zeilenwechsel hat Zeichencode oktal 12
24 System.out.println("Hal" + "lo");
25 System.out.printf("%s%n", "Hallo");
26 System.out.printf("%c%c%c%c%c%n", 'H', 'a', 'l', 'l', 'o');
27 }
28 }
29