What is public used for?


#1

why public is used ??


#2

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


#3

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


#4

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