I always liked string interpolation in JS. Now i found out about Javas MessageFormat'’s format method which lets us in its way use string interpolation.
Transcribed from the original LinkedIn image post.
1
2
3
4
5
6
7
8
9
10
11
12
13
| import java.text.MessageFormat;
public class Day08 {
public static void main(String[] args) {
String stringInterpolation = MessageFormat
.format(
"MessageFormat.format makes {0} {1} happen",
"string",
"interpolation"
);
System.out.println(stringInterpolation);
}
}
|
The original LinkedIn graphic is preserved below.
