summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java
downloadStudium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz
Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java')
-rw-r--r--Master/Reference Architectures and Patterns/hjp5/examples/Listing1107.java36
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