public

On making the method or variable public, we will have access to it across all the packages. That means basically everywhere. There is no restriction for this package of this class. The error observed in the preceding screenshot is also goes once we make the method/variable public.

The following screenshot displays the int value after we made it public:

Quick fixes drop down with suggestions to correct the code error for public

In the next class, we'll look at what private and protected access modifiers are. There are two more access modifiers after this one, let's see what they do.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.6.75