@@ -27,11 +27,7 @@ public StringBuilder one() {
2727 StringBuilder sb = new StringBuilder ();
2828
2929 // 1. Using the sb variable above, add "Hello, world!" to the StringBuilder
30- // WRITE YOUR CODE BETWEEN THIS LINE...
31-
32-
33-
34- // ...AND THIS LINE
30+ sb .append ("Hello, world!" );
3531
3632 return sb ;
3733 }
@@ -41,11 +37,8 @@ public StringBuilder two() {
4137
4238 // 1. Using the sb variable above, add "Hello, world!" to the StringBuilder
4339 // 2. After adding the message, use an appropriate StringBuilder method to reverse it
44- // WRITE YOUR CODE BETWEEN THIS LINE...
45-
46-
47-
48- // ...AND THIS LINE
40+ sb .append ("Hello, world!" );
41+ sb .reverse ();
4942
5043 return sb ;
5144 }
@@ -55,11 +48,8 @@ public StringBuilder three() {
5548
5649 // 1. Using the sb variable above, add "Hello, world!" to the StringBuilder
5750 // 2. After adding the message, remove the comma.
58- // WRITE YOUR CODE BETWEEN THIS LINE...
59-
60-
61-
62- // ...AND THIS LINE
51+ sb .append ("Hello, world!" );
52+ sb .deleteCharAt (5 );
6353
6454 return sb ;
6555 }
@@ -69,11 +59,8 @@ public StringBuilder four() {
6959
7060 // 1. Using the sb variable above, add "Hello, world!" to the StringBuilder
7161 // 2. After adding the message, replace the word "world" with the word "Java"
72- // WRITE YOUR CODE BETWEEN THIS LINE...
73-
74-
75-
76- // ...AND THIS LINE
62+ sb .append ("Hello, world!" );
63+ sb .replace (7 ,12 , "Java" );
7764
7865 return sb ;
7966 }
0 commit comments