String aString = "world";
int aInt = 20;
String.format("Hello, %s on line %d", aString, aInt );
Output will be:
Hello, world on line 20
String.format("Line:%2$d. Value:%1$s. Result: Hello %1$s at line %2$d", aString, aInt );
Output will be:
Line:20. Value:world. Result: Hello world at line 20