Hi,
I read on K&B book (page 68) that a class can have only public or default access.
By doing today a mock exam of eXemulator, I came accross the following code. I responded that the code won't compile because of the LimeTree that is private, but the correct answer was compile, with output 1973.
How do you explain that ??
public class BethRhys{
int iYear=1973;
public static void main(
String argv[]){
BethRhys br = new BethRhys();
br.ewold();
}
public void ewold(){
LimeTree lt = new LimeTree();
lt.nyork();
}
private class LimeTree{
private void nyork(){
System.out.println(iYear);
}
}
}