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????
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.
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????
Hii Jeetu,
The public is access modifiers, every class has some access modifiers they are public, private, protected, and default. Private and Protected access modifiers are not used by the class.
Then you can use any access modifier otherwise it will catch the default access modifier (if you not use any keywords).
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. After that, you can post your question and our members will help you out.