CodeGym /Courses /Java Core /Encapsulation exercises

Encapsulation exercises

Java Core
Level 1 , Lesson 8
Available

"Hello, Amigo! Today you will become a distinguished encapsulation expert. Try these exercises:"

3
Task
Java Core, level 1, lesson 8
Locked
Private encapsulated cat
Private encapsulated cat
3
Task
Java Core, level 1, lesson 8
Locked
Our cat is too public!
Our cat is too public!
3
Task
Java Core, level 1, lesson 8
Locked
The unapproachable cat
The unapproachable cat
3
Task
Java Core, level 1, lesson 8
Locked
Like cats and dogs
Like cats and dogs
3
Task
Java Core, level 1, lesson 8
Locked
Don't forget to encapsulate
Don't forget to encapsulate
Comments (12)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Hoist Level 38, San Diego, United States
22 August 2023
the joy is in the surprise and struggle -- same brain wake-up techniques in Head First Java book(s) -- which was original Java Ranch. Very clever and smart people at Code Gym. Trust the process .
Hoist Level 38, San Diego, United States
4 January 2023
Kinda foggy on this still --- the Method has the same name as the Class --- ie Cat. The class method is mounting up some properties to give it a shape. Not an instance. If you create an object -- each has its own name field. -- from thomas (Germany) >> The scope of the field is the entire class, or better, you can access this field in all methods. If you access a field in a method, you can prefix it with this fieldName. That way you see at once, that it's a field and it won't give problems, if you have parameters with the same name e.g. in the constructor. Is not a variable -- but a field or attribute of the class Cat.
Максим Василенко Level 44, Kiev, Ukraine
14 November 2022
why all tasks have status closed?? And also they already contain solutions.
John Squirrels Level 2, San Francisco, Poland
18 November 2022
If your task is closed, this means it's been more than 3 days since you solved it.
Slawek Level 16, Wroclaw, Poland
27 February 2021
I think that is the way of code gym to learn and repeat. Sometimes I was confuse and some topics are over leveled. But in that way (like this lesson) I'm not worries that I misunderstand some key topics of Java. Let's see what happen next...
26 August 2020
noice!
Renat Mukhametshin Level 16, Pervouralsk, Russain Federation
29 August 2019
ok it's good
Ewerton Level 30, Belo Horizonte, Brasil
29 June 2019
That lesson about getters and setters kinda explained all this.
Kevin Duc Level 17, Denver, United States
31 August 2019
Seems like the lessons are kinda backwards. I'm using codegym as a refresher and I was using techniques in the syntax lessons that we are now supposedly learning. Not sure how anyone who just started Java would be able to solve some of the earlier problems
Thomas Sixberry Level 16, Rochester Hills, United States
7 February 2020
A lot of griping and complaining along with searching stackoverflow, geeks2geeks, etc. Also, the help section was nice as well.
Sela Level 20, Poland
12 July 2020
i did not come here to start from scratch - I came here for tasks
Brad Reed Level 19, Hartford, United States
12 July 2020
I however did come from scratch little under a month ago, there's a lot of re-enforcement of the idea that this is a community effort it would seem.