Instead of:
Cat.count = count;
We have this as solution:
Cat.count++;
Why? I didn't see this anywhere and requirements don't make it easier to understand.
Unless you want to have cats to be above 0 for whatever reason which doesn't specify....
" The Cat class's variable count must have the public modifier, be an int, be static, and be initialized to zero."
Change this task Count the number of cats to Increment to number of cats.
See CodeGym Articles (and the Video) for Setting and and Getting data values
https://codegym.cc/groups/posts/getters-and-setters
> When you see a Topic that is _new_ check out the Articles inside CodeGym. Also their are great Videos.
When data is "private" in the class (the blueprint) -- how can it be accessed and modified ?
hey I just wanted to check how the assignments are getting validated. Do we have access to unit test cases so that we can understand them more clearly?
NOTE: No need to output in main method.
* If a method is declared with the keyword "static", then to access the class variable, you must use "Classname.variableName".
* If a method is NOT declared with the keyword "static", then to access the class variable, you must use the special keyword "this", i.e. "this.variableName".
GO TO FULL VERSION