CodeGym /Courses /Java Syntax /Practice with variable visibility

Practice with variable visibility

Java Syntax
Level 4 , Lesson 2
Available

"Hi, Amigo."

"Hi, Diego."

"I brought you a few tasks about the visibility of variables."

Comments (115)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Laguna.jpeg Level 1, Fortaleza, Brazil
23 November 2025
It's getting easier little by little. I feel that soon, I will be working as a Java programmer. It's kind of cool.
Immemorial Level 4, Sweden
13 July 2025
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.
Hoist Level 12, San Diego, United States
19 August 2023
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 ?
CT Level 1, India
8 August 2023
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?
chonksta Level 6, Dallas, United States
23 June 2023
Search youtube for getters, setters, constructors java
rags 3 Level 5, Wichita, United States Expert
20 June 2023
definitely would say read head first java definitely helped connect the dots for me
abhishe_kira Level 18, India Expert
3 June 2023
hey Learner if you are new to java please watch Oops concept before solving these problems.
rags 3 Level 5, Wichita, United States Expert
20 June 2023
thank you that help allot still alone wasn't enough for me at this point was to frustrated but all and all little here little there and maybe success
Simphiwe Level 33, Johannesburg, South Africa
9 February 2023
Practice makes perfect 💯
Lunita Level 4, Dominican Republic
3 February 2023
I'm proud of myself RN, got all at the first attempt! 😃
Lunita Level 4, Dominican Republic
3 February 2023
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".