|
A package method can be called by any class within its package.
This is the default access level if no access level is explicity declared. The other options for declaring visibility are private, public, and protected.
The packageMethod() method is a private method in the following class:
public class MyClass {
private void privateMethod() {
System.out.println("I am private method");
}
void packageMethod() {
System.out.println("I am package method");
}
protected void protectedMethod() {
System.out.println("I am protected method");
}
public void publicMethod() {
System.out.println("I am public method");
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.