What is public used for?

why public is used ??

public indicates the scope of class or method, see here for all the access levels:

https://stackoverflow.com/questions/215497/in-java-difference-between-package-private-public-protected-and-private

Public is one of the main access modifier of Java language, that means that the class, the object or the method that you create can be called from anything that you created before

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.