Question: In the following code: public class Dog { int ageMonths; //Age of dog in months public void increaseMonth () { int years; ageMonths = ageMonths
In the following code: public class Dog \{ int ageMonths; //Age of dog in months public void increaseMonth () \{ int years; ageMonths = ageMonths +12; years=ageMonths/12; \} public static void main(String[] args) \{ Dog mjDog = new Dog (); myDog.increaseMonth(); myDog. increaseMonth(); System.out.print("My dog is about " + myDog.ageMonths/12 + " years old"); \} \} Which one is an attribute/member variable of the class Dog? agemonths ageMonths years myDog
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
