Is a class always public in Java?

In Java, a top-level class is either public or non-public . There is no “private”. You can only use the public keyword or leave it off. If you leave it off it is non-public, i.e., visible only to other classes in the same package.

Sizin İçin Seçtik  How do you create an object?

Leave a Reply

Your email address will not be published. Required fields are marked *