title: How do you access a private integer (declared in a nested class) from a method within the starter class?
body: <p>I've seen lots of questions about accessing private methods, but none about accessing private integers, so I figured this was worth asking. Basically, I have my main class, RunnyStack, with a private nested class called Run. Inside Run, I initialized a private integer, length, and I'm trying to access this private int from a method inside RunnyStack. </p>
  
  <p>I've already tried searching up this problem (for too long), and the answers I found don't work for me, because (per class instructions) I need to declare length as a private int inside Run. This means (from what I've tried) I cannot do 'Run hello = new Run();", because it says 'The constructor RunnyStack.Run() is undefined'. I also tried 'RunnyStack.Run len = new RunnyStack.Run();', but it just said 'The constructor RunnyStack.Run() is undefined'</p>
  
  <pre><code>    class RunnyStack&lt;Base&gt; {
  private class Run {
      private Base base;
      private Run next;
      private int length;
  
      private Run(Base base, Run next) {
          this.base = base;
          this.next = next;
          this.length = 0;
      }
  }
  </code></pre>
  
  <p>This code shows the creation of the nested private class, including the private integer length.</p>
  
  <pre><code>    public void push(Base base) {
      if(isEmpty()) {
          top = new Run(base, top);
      }
      else {
          if(base == top) {
              length += 1;
          }
      }
  }
  </code></pre>
  
  <p>This code shows the method I'm trying to access length in</p>
  
  <p>All I want to do is access length so that I can increase it whenever the if statement is fulfilled.
  Any help is appreciated, thanks!</p>