What is the difference between class and public class?

A public class has “public” visibility, which means that it is accessible to any class in any package, while a class has “default” or “package” visibility, i.e. the class is accessible only to classes inside the same package. Also if you are working only on one package then there is no difference, you can use both.

Sizin İçin Seçtik  Why do we use public class?

Leave a Reply

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