Java – how to hide public methods?
•
Java
There is a method in my static state machine that is used only once when my application starts for the first time This method needs to be exposed, but I still want to hide it Is there any way to use annotations or some way to hide the method in the rest of the project?
Solution
Once you declare the public method, it will become part of your class contract You cannot hide it because all class users want this method to be available
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码