Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
String adjective = "little";
|
||||
String lyric = String.format("Mary had a %s lamb", adjective);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
String adjective = "little";
|
||||
String lyric = "Mary had a %s lamb".formatted(adjective);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
String adjective = "little";
|
||||
System.out.printf("Mary had a %s lamb", adjective);
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
StringBuilder string = new StringBuilder();
|
||||
Formatter formatter = new Formatter(string);
|
||||
String adjective = "little";
|
||||
formatter.format("Mary had a %s lamb", adjective);
|
||||
formatter.flush();
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
String original = "Mary had a X lamb";
|
||||
String little = "little";
|
||||
String replaced = original.replace("X", little); //does not change the original String
|
||||
System.out.println(replaced);
|
||||
//Alternative:
|
||||
System.out.printf("Mary had a %s lamb.", little);
|
||||
//Alternative:
|
||||
String formatted = String.format("Mary had a %s lamb.", little);
|
||||
System.out.println(formatted);
|
||||
Loading…
Add table
Add a link
Reference in a new issue