[Solved] Java Inner class – access to the variables of outer object


I assume that you want something like this:

class B
{
   private int getNum()
   {
      return myNumber;
   }

   private void setNum(int x)
   {
      myNumber = x;
   }
}

However, you cannot get access to myNumber from an instance of B, b, by doing b.myNumber. Here’s why.

4

solved Java Inner class – access to the variables of outer object