Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/main/java/com/booleanuk/core/Exercise.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class Exercise extends ExerciseBase {

The above assumes that the MyClass class has a constructor that defines a single parameter: a String.
*/


public Exercise(String name) {
// A constructor must always be named exactly the same as the class name. This is the constructor for the
// Exercise class, which accepts one string parameter.
Expand Down Expand Up @@ -51,20 +53,28 @@ public Exercise(int age) {
Create a constructor that accepts both a String and an int as parameters, in that order, and assign the values
provided to the name and age members
*/
public Exercise(String name, int age){
this.age = age;
this.name = name;
}



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

public int add(int num1, int num2) {
return num1+num2;
}


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

public String add(String s1, String s2){
return s1+" "+s2;
}


}
Loading