Task : Implement the addNewCat method, so that when it’s called (that is, when a new cat is added) the number of cats increases by 1. The catsCount variable is responsible for the number of cats. Code : public class Cat { private static int catsCount = 0; private static int num = 0;

public static void addNewCat(int numCat1) {

      num = numCat1;
      catsCount++;

}

public static void main(String args[])
{
    Cat cat = new Cat();
    cat.addNewCat(1);
}

}

does not pass the test, help with the decision.

asked 31 Oct, 07:56

den's gravatar image

den
111
accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×10
×9
×7
×6
×2

Asked: 31 Oct, 07:56

Seen: 36 times

Last updated: 31 Oct, 07:56