I've encountered one interesting thing to me relating to the basics of Java. Here's the code:
class Whoa {
  private int n;
  private void d() {
    Whoa whoa = new Whoa();
    whoa.n = 1;
  }
}
Why the field n of object whoa is accessible? I mean, OK, we're in the class. But whoa is the separate object, I thought we have access only to the fields of a current object. Although I admit that if we have a method that takes a Whoa parameter:
private void b(Whoa w) {
  w.n = 20;
}
we'll definitely have access to n. It's all quite confusing. Could anyone clarify this please?
 
     
     
    