Could anyone tell me about the accessing level of private member? I have been confused with this piece code for quite a long time: why the private member, k of Line class, can be accessed in "print" method of outter class?
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);
}
}