The Three "Muscateers"

  • 2
  • Locked
A couple of tasks ago, students at the secret CodeGym center created the class Cat. Now it's time to actually create some cats in the image and likeness of the Cat class, or rather using the class as a pattern. There should be three cats. Breathe life (or specific data) into this trio.
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Joshua Swigut
Level 12 , Buffalo, United States
31 March 2020, 01:35
public static class Cat {
        private String name;
        private int age;
        private int weight;
        private int strength;

        public Cat(String name, int age, int weight, int strength) {
   = name;
            this.age = age;
            this.weight = weight;
            this.strength = strength;
I don't understand why we have a public static class that identifies all the variables and then a public class with basically the same thing. It seems redundant but I'm sure I'm just missing the bigger picture.
Brandon Leirer
Level 7 , Keller, United States
2 June 2020, 19:15
I've been trying to figure this out as well. I don't think the public Cat is a class though. It looks like a method used to assign all of this data into the private class instance variables. Which....sounds exactly like a set(). So I am not sure why this isn't worded as: public setCat(String name, int age, int weight, int strength) { Unless I am getting this totally confused.
Level 9 , Vilnius, Lithuania
25 September 2020, 09:53
It's not a class (the 2nd one), it's a constructor