What are different types of access modifiers?

Author Topic: What are different types of access modifiers?  (Read 1861 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)
  • Hero Member
  • *****
  • Thank You 22
  • Posts: 608
  • Karma: 0
  • Gender: Male
    • Taxi app development
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
2067 Views
Last post 01-19-2012, 22:54:39
by cpaoutsourcing
1 Replies
2896 Views
Last post 07-28-2014, 02:03:44
by Siservices
3 Replies
2383 Views
Last post 02-28-2015, 02:42:43
by jannatul18
0 Replies
1102 Views
Last post 03-04-2015, 13:45:27
by jackmanson
2 Replies
2457 Views
Last post 10-25-2017, 04:10:06
by damponting44