What is difference between public/private and protected and default in Java?

Differences. First and important difference is the accessibility i.e. anything public is accessible to anywhere , anything private is only accessible in the class they are declared , anything protected is accessible outside the package but only to child classes and default is accessible only inside the package.

Sizin İçin Seçtik  Milli Piyango uygulaması hangisi?

Leave a Reply

Your email address will not be published. Required fields are marked *