Reference the same value during format in Java

Description

The following code shows how to reference the same value during format.

Example


/*from ww w  .  ja va 2  s .  c o m*/
public class Main {
  public static void main(String args[]) {

    System.out.println(String.format("Hi %s at %s", "name", "your place"));
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Data Format »




Java Formatter
Java Number Formatter