java use variables inside strings code example
Example: java use variables inside strings
Java 15+
String foo = "foo";
String bar = "bar";
String str = "First %s, then %s".formatted(foo, bar);
Java 15+
String foo = "foo";
String bar = "bar";
String str = "First %s, then %s".formatted(foo, bar);