GA Logo

Classes Lab in Second Language


Directions (make sure to test your code as you go)

  • Create a Cat class
  • At instantiation you can pass a name and age to the cat constructor
  • The cat has a meow method (should print "meow" to the console)
  • Create a child class called Cheshire that inherits from cat
  • Override the meow method in cheshire to say "Meow and a Grin"
  • Create a new class called Wonderland
  • Give wonderland a static method, MadHatters, that prints "No Cat here"
  • Give wonderland a static method, QueenOfHearts, that prints "No Cat Here"
  • Give wonderland a static method, tree, that prints "Found the Cheshire Cat" and returns a new instance of Cheshire


Resources to Learn More