What are different types of access modifiers?

Author Topic: What are different types of access modifiers?  (Read 1508 times)

Offline chinmay.sahooTopic starter

  • Trade Count: (0)
  • Full Member
  • ***
  • Thank You 2
  • Posts: 158
  • Karma: 0
    • Hot Shaper
What are different types of access modifiers?
« on: 01-25-2016, 02:07:24 »
public: Any thing declared as public can be accessed from anywhere. private: Any thing declared as private can’t be seen outside of its class. protected: Any thing declared as protected can be accessed by classes in the same package and subclasses in the other packages. default modifier : Can be accessed only to classes in the same package.


Offline damponting44

  • Trade Count: (0)
  • Sr. Member
  • ****
  • Thank You 18
  • Posts: 396
  • Karma: 0
  • Gender: Male
    • Mobisoft Infotech
Re: What are different types of access modifiers?
« Reply #1 on: 10-25-2017, 04:08:13 »
The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
1881 Views
Last post 01-19-2012, 22:54:39
by cpaoutsourcing
1 Replies
2713 Views
Last post 07-28-2014, 02:03:44
by Siservices
3 Replies
2156 Views
Last post 02-28-2015, 02:42:43
by jannatul18
0 Replies
967 Views
Last post 03-04-2015, 13:45:27
by jackmanson
2 Replies
1863 Views
Last post 10-25-2017, 04:10:06
by damponting44