+ 1
Can i access default access modifier in other package after importing that package and inheriting the desired class?
Java
2 ответов
+ 1
Default is package private so... no. If I understand you correctly.
Example
In package a.b.c, we have:
public class A { int d = 3; }
In another package x.y.z we have:
import a.b.c.A;
public class X {
public void main(String[] args) {
A var = new A();
int x = var.d; // error! d is package private
}
}
0
thank you buddy!
that exactly was my question.