Skip to content

Commit fef892f

Browse files
committed
Complete extension exercises
1 parent c6e7991 commit fef892f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/com/booleanuk/extension/Extension.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public StringBuilder one() {
2929
// 1. Using the sb variable above, add "Hello, world!" to the StringBuilder
3030
// WRITE YOUR CODE BETWEEN THIS LINE...
3131

32-
32+
sb.append("Hello, world!");
3333

3434
// ...AND THIS LINE
3535

@@ -43,7 +43,8 @@ public StringBuilder two() {
4343
// 2. After adding the message, use an appropriate StringBuilder method to reverse it
4444
// WRITE YOUR CODE BETWEEN THIS LINE...
4545

46-
46+
sb.append("Hello, world!");
47+
sb.reverse();
4748

4849
// ...AND THIS LINE
4950

@@ -57,7 +58,8 @@ public StringBuilder three() {
5758
// 2. After adding the message, remove the comma.
5859
// WRITE YOUR CODE BETWEEN THIS LINE...
5960

60-
61+
sb.append("Hello, world!");
62+
sb.deleteCharAt(5);
6163

6264
// ...AND THIS LINE
6365

@@ -71,7 +73,8 @@ public StringBuilder four() {
7173
// 2. After adding the message, replace the word "world" with the word "Java"
7274
// WRITE YOUR CODE BETWEEN THIS LINE...
7375

74-
76+
sb.append("Hello, world!");
77+
sb.replace(7, 12, "Java");
7578

7679
// ...AND THIS LINE
7780

0 commit comments

Comments
 (0)