谁能告诉我私人会员的访问级别?我对这段代码困惑了很久:为什么Line类的私有成员k可以在outter类的“print”方法中访问?
public class myClass {
public static class Line{
private double k;
private double b;
private boolean isVertical;
public Line(double k, double b, boolean isVertical){
this.k = k;
this.b = b;
this.isVertical = isVertical;
}
}
public static boolean print(Line line){
System.out.println(line.k);
}
}