Is there any way to declare a method “friendly” in Java?

I know you can set the property to public, friendly or private to specify its visibility

Is there any way to announce a friendly way? I want it to be accessible only from objects of classes in the same package

Thank you, beginners here: (

Solution

Java uses package private scope by not entering the visibility modifier

View the following articles

Editor: as stated in the comment, there is no way to mark the method as "friendly" However, according to your needs, package - private is enough

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
分享
二维码
< <上一篇
下一篇>>