File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/main/java/com/booleanuk/core Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -51,12 +51,20 @@ 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+ {
56+ this .name = name ;
57+ this .age = age ;
58+ }
5459
5560
5661
5762 /*
5863 2. Create a method named add that accepts two integers. The method should return the numbers added together.
5964 */
65+ public int add (int a , int b ){
66+ return a + b ;
67+ }
6068
6169
6270
@@ -65,6 +73,10 @@ public Exercise(int age) {
6573 together with a space in between.
6674 */
6775
76+ public String add (String a , String b ){
77+ return a + " " + b ; // String.format would look nicer...
78+ }
79+
6880
6981
7082}
You can’t perform that action at this time.
0 commit comments