diff options
Diffstat (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java')
| -rw-r--r-- | Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java b/Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java new file mode 100644 index 0000000..9562b55 --- /dev/null +++ b/Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java @@ -0,0 +1,36 @@ +/* Listing1107.java */
+
+import java.util.*;
+
+public class Listing1107
+{
+ public static void main(String[] args)
+ {
+ //Boolesche Werte
+ System.out.format("%b %b %2$b %1$b%n", true, false);
+ //Ganzzahlen
+ System.out.format("[%d]%n", -2517);
+ System.out.format("[%7d]%n", -2517);
+ System.out.format("[%-7d]%n", -2517);
+ System.out.format("[%(7d]%n", -2517);
+ System.out.format("[%07d]%n", -2517);
+ System.out.format("[%,7d]%n", -2517);
+ System.out.format("%1$d %<o %<x %<X%n", 127);
+ //Fließkommazahlen
+ System.out.format("%f%n", 0.000314);
+ System.out.format("%1$6.2f %1$6.2e %1$6.2E %1$6.2G%n", 3.141592);
+ System.out.format("%,8.2f%n", 31415.92);
+ System.out.format(Locale.ENGLISH, "%,8.2f%n", 31415.92);
+ //Zeichen und Strings
+ System.out.format("%c%c%c\n", 97, 64, 98);
+ System.out.format("%s nein\n", "ja");
+ //Datum/Uhrzeit
+ Calendar now = Calendar.getInstance();
+ System.out.format(
+ "%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS%n",
+ now
+ );
+ System.out.format("%tF%n", now);
+ System.out.format("%tc%n", now);
+ }
+}
\ No newline at end of file |
