Java help

Discussion in 'Java' started by Jeetu, Oct 4, 2018.

  1. Jeetu

    Jeetu

    Joined:
    Oct 4, 2018
    Messages:
    1
    Likes Received:
    0
    hii, i hava started to learn java before some days, I have the question that, what will happen if we do not put the public keyword before the class name????
     
    Jeetu, Oct 4, 2018
    #1
    1. Advertisements

  2. Jeetu

    John Joe

    Joined:
    Apr 25, 2017
    Messages:
    99
    Likes Received:
    14
    Location:
    Malaysia
    public, protected and private are access modifiers. Public means that the subject may be accessed by any class, protected by subclass, private by the class itself, no modifier means "package protected", so the subject may be accessed by classes from the same package.

    Subject is class, method, member variable.


    Answer get from https://stackoverflow.com/a/16779279/5156075
     
    John Joe, Oct 5, 2018
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.