Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8648235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:16:01+00:00 2026-06-12T13:16:01+00:00

I’m running into some trouble with nested classes on a project for school. Currently,

  • 0

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:

insertLoc.findEnd(item)

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.

Here is the relevant code >>

nested class for ListLoc object:

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);
  }
}

Method to find the last index of a matching item (not part of ListLoc nested class):

private ListLoc findEnd(E item){
  E itemAtIndex;

  for (int i = topArray.length -1; i >= 0; i--) {
     L2Array nextArray = (L2Array)topArray[i];

     if (nextArray == null) {
        continue;

     } else {

        for (int j = nextArray.items.length -1; j >= 0; j--) {
           itemAtIndex = nextArray.items[j];
           if (itemAtIndex.equals(item)) {
              return new ListLoc(i, j+1);
           }
        }
     }
  }

  return null;

}

Method attempting to add a new value to the ragged array:

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;

}

Thanks for any input.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:16:02+00:00Added an answer on June 12, 2026 at 1:16 pm

    I’m going to bet that changing this:

    ListLoc insertLoc = new ListLoc();
    insertLoc.findEnd(item);
    

    To this:

    ListLoc insertLoc = findEnd(item);
    

    Will fix your problem.

    You’re trying to call findEnd on the ListLoc class, but if you actually look at ListLoc, it’s not defined there. When you tried to call findEnd on the insertLoc object, it fails because insertLoc is an instance of ListLoc, which we already said doesn’t contain findEnd.

    That being said, I’m going to bet that findItem is actually declared in the same class as the add method (let’s just call it MyList), so you wanted to actually call MyList.findEnd, not the non-existent ListLoc.findEnd.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.