Posted by Rob on Wednesday, October 28, 2009 at 2:17am.
The fifth Kitty is myCats[4], since the index starts from zero.
Each member of the array myCats is a Kitty object.
1)
To increase the age, you need to get the age of myCats[4], add one to it, and put back the increased age. This is how you can do it:
myCats[4].setAge(myCats[4].getAge()+1);
2)
int age4=myCats[3].getAge();
int age5=myCats[4].getAge();
if(age4>age5)
{
System.out.print(myCats[3].getName());
} else
{
... to be completed by you ...
}
Related Questions
Programming - The code below shows some of the text for a class called City. Now...
programming - m trying to create an arraylist that's sorted but I have no ...
Java Panel Problem - I am supose to draw a grid and center it with a 10 pix ...
computer science - Im trying to create an arraylist that's sorted but I have...
shabou - Can someone please make a Binarytree of these methodes in Java?: public...
Java - I am supposed to convert a program i already made into a Java console ...
Java programming - List all overloading methods (including constructors) in this...
java programming - Provide a class called Letter for authoring a simple letter. ...
computer science - i have two numbers... 1564656 1981676 i want to check if the ...
Computer Sciene-java - Write a loop that will continuously prompt the user for ...
For Further Reading