Answer:
System.out.println("Kids: " + person1.getNumKids());
person1.incNumKids();
System.out.println("New baby, kids now: " + person1.getNumKids());
Step-by-step explanation:
Reminder: To be able to call a function that is inside a class, we need to use an object of that class. In this case, person1 is our object. If we would like to access any function, we need to type person1.functionName().
1) We need to call getNumKids() to get how many kids they have (It is 3 because user inputs 3 and it is set to the this value using setNumKids() function). To call this function, we need to use person1 object that is created earlier in the main function. To be able to print the result, we call the function inside the System.out.println().
2) To increase the number of kids, we need to call incNumKids() method with person1 object again. This way number of kids are increased by one, meaning they have 4 kids now.
3) To get the current number of kids, we need to call getNumKids() function using person1 object. To be able to print the result, we call the function inside the System.out.println().