Forums Java Help What is the difference between private, protected, and public

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15241
    juwanine
    Participant

    What is the difference between private, protected, and public?

    #15244
    ahprofessional
    Participant

    These keywords are for allowing privileges to components such as java methods and variables.
    Public: accessible to all classes
    Private: accessible only to the class to which they belong
    Protected: accessible to the class to which they belong and any subclasses.
    Access specifiers are keywords that determines the type of access to the member of a class. These are:
    * Public
    * Protected
    * Private
    * Defaults

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.