package week1;
public class CatThisClassTest
{
public static void main(String[] args)
{
CatThis cat1 = new CatThis("Fluffy", "", 3);
CatThis cat2 = new CatThis("Catty", "red", 4);
System.out.println("information about cat1: ");
cat1.information();
System.out.println("information about cat2: ");
cat2.information();
}
}
package week1;
public class CatThis
{
String name;
String colour;
int age;
public CatThis(String name, String colour, int age)
{
this.name = name;
this.colour = colour;
this.age = age;
}
public void meow()
{
System.out.println("meow!moew");
}
public void eat()
{
System.out.println("yumy!yumy");
}
public void information()
{
System.out.println("the name is " + this.name);
System.out.println("the colour is " + this.colour);
System.out.println("the age is " + this.age);
}
}