Cat relations

  • 10
Finished task: A cat has a name and a mother. Create a class that reflects this. Create two objects: a daughter cat and a mother. Display them on the screen. New task: Each cat has a name, a father, and a mother. Edit Cat so that it reflects these relationships. Create 6 objects: grandfather (the father's father), grandmother (the mother's mother), father, mother, son, daughter.
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
PaulLevel 8 , Mae Chan
12 November 2019, 04:56
I have a question, I would like to create constructor methods, that take the name and a reference to an object as values, f.e: Cat(String name, Cat mother) {} Cat(String name , Cat father) {} here female and male objects are not the same , I solved it by turning the father constructor : Cat(Cat father, String name) {} , so I can decide which constructor to use. It works, but it is probably not the right solution, because if I had 3 different kind of objects, to reference to , it wouldn't work anymore. Could someone tell me how you solved this issue?
DanielLevel 8 , Colnbrook
14 January, 20:54
I hope I'm not ruining the "AHA moment", but why make it complicated? When only one parent is there, the other one is ...null. Just noticed you posted the question in November.
Kent HerveyLevel 9
25 October 2019, 22:20
This did not seem hard to figure...but very tedious. Some passed in objects to constructor, but I did not...okay I noticed that the number of people who completed this one is about 60% of previous, so I guess many decided to move on.
carlos oliveiraLevel 8 , Seattle
22 April 2019, 18:55
omg!!! how flexible is Java!!! unbelievable! I really could not expect how i can twist things and its just work fine... its kind a free service objects you just need to create constructors/containers("if i can use this term") to accept them. i never seen this in any other programming language. I had to confess its took me a full day to understand it, but i got it now. just amazing!!
haet trivediLevel 7 , Vasai-Virar
12 January 2019, 07:11
where am i wrong output is correct but not verifying it plzz help.
RomanLevel 41
14 January 2019, 07:12
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at
Vishwambhar AwaganLevel 8 , Pune
26 October 2018, 17:26
See the condition there u need to create new task..
Sonu TiwariLevel 15 , Hyderabad
21 September 2018, 09:19
Why I am getting error now? Everything seems good here.