Menu
gps garage
  • Home
  • Health
  • Nature
  • IT & Software
  • Science
  • Technology
  • Offers
  • Write for Us
    • Privacy Policy
    • Terms & Conditions
gps garage

Access specifiers in Java

Posted on May 1, 2021May 1, 2021

Discuss the access specifiers in Java and their types.

To define the access scope of class, method, & variables, access specifiers are used in java. Following are the four access specifiers in java:

  • Public: When apply on variables, methods and classes then can be accessible to everywhere means accessible by any method and class.
  • Protected:  Accessible in the same package or sub-class of this class and also accessible within the class.
  • Default: When a class, variable or method is defined as default then they are accessible within the package only.

         Note – by default, all the method, classes and variables are default. If you define nothing then it is consider as  default.

  • Private: When apply on variable, class or methods then all are accessed only within the class.

Download JDK

Download JRE

 

Must Read – How to run your java program?

Categories

  • Education
  • Entertainment
  • Features
  • Game
  • Health
  • IT & Software
  • Must Read
  • Nature
  • News
  • Offers
  • Popular News
  • Science
  • Technology
  • Trending News
  • World

Archives

  • March 2025
  • January 2025
  • December 2024
  • September 2022
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021

Categories

  • Education
  • Entertainment
  • Features
  • Game
  • Health
  • IT & Software
  • Must Read
  • Nature
  • News
  • Offers
  • Popular News
  • Science
  • Technology
  • Trending News
  • World

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2025 GPS Garage | Powered by SuperbThemes