문제

I know what the difference between private, public and protected. but I don't know what the difference between private field and filed without any access modifiers.

class Example{
private int field1;
int field2;
}
도움이 되었습니까?

해결책

In Java if you leave the access specifier off then the member is "package" level. Package level members can be seen by the class that defines the member and other classes in the same package. The difference between that and private are private members may only be seen by the class which defines it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top