Build a sentence with Formatter in Java
Description
The following code shows how to build a sentence with Formatter.
Example
/*w w w. j a v a2 s. c o m*/
import java.util.*;
public class Main {
public static void main(String args[]) {
Formatter fmt = new Formatter();
fmt.format("Formatting %s is easy %d %f", "with Java", 10, 98.6);
System.out.println(fmt);
}
}
The code above generates the following result.