Skip to content

Commit 835f43f

Browse files
author
Hanna Adenholm
committed
finished ex
1 parent e19b26f commit 835f43f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,24 @@ public Exercise(int age) {
5151
Create a constructor that accepts both a String and an int as parameters, in that order, and assign the values
5252
provided to the name and age members
5353
*/
54+
public Exercise(String name, int age) {
55+
this.name = name;
56+
this.age = age;
57+
}
5458

5559

5660

5761
/*
5862
2. Create a method named add that accepts two integers. The method should return the numbers added together.
5963
*/
60-
64+
public int add(int n1, int n2) { return n1 + n2; }
6165

6266

6367
/*
6468
3. Create another method named add that accepts two Strings. The method should return the strings concatenated
6569
together with a space in between.
6670
*/
67-
71+
public String add(String s1, String s2) { return s1 + " " + s2; }
6872

6973

7074
}

0 commit comments

Comments
 (0)