Feline carnage

  • 4
  • Locked
If you think all cats are cute fur balls, you probably haven't encountered alley cats in a heated struggle for supremacy in a certain area. It's time for you to meet them. More precisely, it's time to simulate a decisive battle between the three most powerful cats in the neighborhood. For combat, we will use the boolean fight(Cat anotherCat) method.
You can't complete this task, because you're not signed in.
Comments (9)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Joe M
Level 47 , Owings Mills, United States
6 October 2020, 18:26
OK...learning
Syed Huzaifa
Level 7 , Karachi, Pakistan
9 May 2020, 20:50
create there objects of Cat class call the method of fight on each object and pass the other cat object
catObj1.fight(catObj2)
and try to display the result that could be done in number of ways u've to think
smortne
Level 15 , Oslo, Norway
25 January 2020, 19:20
If you changed the code in line 38 from "score > 2" to "score > 1" it might please some furious losing cats...
Brandon Nicolle
Level 5 , Edmonton, Canada
23 August 2019, 03:15
Can somebody tell me what lesson they taught how to use (Cat anotherCat) as obj1.fight(obj2). I was trying to use it as : System.out.println(fight(obj1, obj2)); But that didn't work.
Brandon Leirer
Level 7 , Keller, United States
2 June 2020, 20:49
This wasn't really explained anywhere that I have seen. There is a place that says when using the dot operator the object attached to it is set as the first argument. So, cat1.fight() would call the fight method and assign cat1 object as the first argument. cat1.fight(cat2) would set cat2 two as the second argument. But I agree with you, writing (Cat anotherCat) is confusing. I'm still not 100% sure how that is supposed to indicate that only one cat object goes in there.
Param M
Level 8 , Mumbai, India
26 June 2019, 04:19
guys all you need to do is this
/* DELETED */
in the main method. Do not touch the default setting of theirs
Roman
Level 41
26 June 2019, 05:53
Posting the solution in the comments is prohibited.
Jaisingh
Level 14 , Hyderabad, India
15 September 2018, 14:40
How should i deal with the static class, i have studied that static variable and static methods are accessed without creating object, shell we create object of static Class, and we apply this operator for static variable or static methods it is by default is null. so what will be for the static class, so please help me quick
Roman
Level 41
17 September 2018, 05:22
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 codegym.cc/help.