< Java Tutorial
In Java, there are two types of access modifiers. They're public
and private
. A private can call a public, but a public can't call a private. Example:
public class PublicPrivate {
private static void main ( string[] args ) {
System.out.println("This method is private");
}
}
This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.