MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

strings/SimpleFormat.java:7–16  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

5
6public class SimpleFormat {
7 public static void main(String[] args) {
8 int x = 5;
9 double y = 5.332542;
10 // The old way:
11 System.out.println("Row 1: [" + x + " " + y + "]");
12 // The new way:
13 System.out.format("Row 1: [%d %f]%n", x, y);
14 // or
15 System.out.printf("Row 1: [%d %f]%n", x, y);
16 }
17}
18/* Output:
19Row 1: [5 5.332542]

Callers

nothing calls this directly

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected