Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
String adjective = "little";
String lyric = String.format("Mary had a %s lamb", adjective);

View file

@ -0,0 +1,2 @@
String adjective = "little";
String lyric = "Mary had a %s lamb".formatted(adjective);

View file

@ -0,0 +1,2 @@
String adjective = "little";
System.out.printf("Mary had a %s lamb", adjective);

View file

@ -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();

View file

@ -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);