Skip to content

Commit 4b97800

Browse files
committed
Exercise completed
1 parent e19b26f commit 4b97800

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/com/booleanuk/core/Exercise.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,22 @@ public Exercise(int age) {
5252
provided to the name and age members
5353
*/
5454

55-
55+
public Exercise(String name, int age) {this.name = name; this.age = age;}
5656

5757
/*
5858
2. Create a method named add that accepts two integers. The method should return the numbers added together.
5959
*/
6060

61-
61+
public int add(int num1, int num2) {
62+
return num1 + num2;
63+
}
6264

6365
/*
6466
3. Create another method named add that accepts two Strings. The method should return the strings concatenated
6567
together with a space in between.
6668
*/
6769

68-
69-
70+
public String add (String str1, String str2) {
71+
return str1 + " " + str2;
72+
}
7073
}

0 commit comments

Comments
 (0)