title: method undefined for type Java, nested classes
body: <p>I'm running into some trouble with nested classes on a project for school. 
  Currently, I'm trying to write a method to insert an item into a ragged array data structure.
  It uses an object created by a nested class to keep track of the 2d array location in order to get the indexes to insert at. However, I am getting the error "The method findEnd(E) is undefined for the type RaggedArrayList.ListLoc" on the line:</p>
  
  <pre><code>insertLoc.findEnd(item)
  </code></pre>
  
  <p>I have searched extensively both on stackoverflow as well as around the web and have not found the answer yet. If I have missed it and this is redundant (there are a lot of "method undefined for type questions", I know) then I apologize. </p>
  
  <p>Here is the relevant code >></p>
  
  <p>nested class for ListLoc object:</p>
  
  <pre><code>private class ListLoc {
    public int level1Index;
    public int level2Index;
  
    public ListLoc() {}
  
    public ListLoc(int level1Index, int level2Index) {
       this.level1Index = level1Index;
       this.level2Index = level2Index;            
    }
  
    public int getLevel1Index() {
       return level1Index;
    }
  
    public int getLevel2Index() {
       return level2Index;
    }
  
    // since only used internally, can trust it is comparing 2 ListLoc's
    public boolean equals(Object otherObj) {
       return (this == otherObj);
    }
  }
  </code></pre>
  
  <p>Method to find the last index of a matching item (not part of ListLoc nested class):</p>
  
  <pre><code>private ListLoc findEnd(E item){
    E itemAtIndex;
  
    for (int i = topArray.length -1; i &gt;= 0; i--) {
       L2Array nextArray = (L2Array)topArray[i];
  
       if (nextArray == null) {
          continue;
  
       } else {
  
          for (int j = nextArray.items.length -1; j &gt;= 0; j--) {
             itemAtIndex = nextArray.items[j];
             if (itemAtIndex.equals(item)) {
                return new ListLoc(i, j+1);
             }
          }
       }
    }
  
    return null;
  </code></pre>
  
  <p>}</p>
  
  <p>Method attempting to add a new value to the ragged array:</p>
  
  <pre><code>boolean add(E item){
    ListLoc insertLoc = new ListLoc();
    insertLoc.findEnd(item);
  
    int index1 = insertLoc.getLevel1Index();
    int index2 = insertLoc.getLevel2Index();
  
    L2Array insertArray = (L2Array)topArray[index1];
    insertArray.items[index2] = item;
  
    return true;
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks for any input.</p>