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

  • SEARCH
  • Home
  • 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 9271067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:31:34+00:00 2026-06-18T15:31:34+00:00

So I have this project I am working on and I need to create

  • 0

So I have this project I am working on and I need to create my own ArrayList class for it. I have all my methods defined, but when I compile I keep getting a “cannot find symbol” error for three of my methods. I have an interface that looks like this:

public interface FBList {

    public int size();

public void insert(int i, Person person);

public Person remove(int i);

public Person lookUp(int i);

/**
*A class that defines a person
**/
public class Person {
    private String id;
    private long phoneNum;

    public Person(String personID, long phoneNum){
        id = personID;
        phoneNum = phoneNum;
    }
}

As you can see, I have an inner class in there. I am trying to use that class in my other file which implements this interface. Currently, the three methods in my other file giving me the issue are as follows:

/**
    * A method to expand the size of the array if the array is too small
    * @param i  One minus the place in the list where the component will be inserted
    * @param Person The person to be put in the list
    **/
    protected void expandInsert(int i, Person person){
        Person[] temp = new Person[arrayList.length * 2];
        for(int index = 0; index < temp.length; index++){
            if( i != index){
                if(i > 0)
                    temp[index] = arrayList[index];
                if(i == 0)
                    temp[index + 1] = arrayList[index];
            }
            else{
                temp[i] = person;
                i = 0;
                index--;
            }
        }
        arrayList = temp;
    }

/**
    * Inserts a new component at the end of a list by creating a new list longer that then last
    * @param i The place in the list where the component will be inserted
    * @param Person The person to be added to the list
    **/

protected void insertAtEnd(int i, Person person){
    Person[] temp = new Person[arrayList.length + 5];
    for(int index = 0; index < temp.length; index++){
        if(index != i){
            temp[index] = arrayList[index];
        }
        else{
            temp[index] = person;
        }
    }
    arrayList = temp;
}

/**
* Shrinks the array by one by removing one component from the array
* @param i The index to be removed
**/

protected void shrink(int i){
    Person[] temp = new Person[arrayList.length - 1];
    for (int index = 0; index < arrayList.length ; index++ ) {
        if (index < i) {
            temp[index] = arrayList[index];
        }
        else if (index == i){
            removedPerson = arrayList[index];
            temp[index] = arrayList[index + 1];
        }
        else{
            temp[index - 1] = arrayList[index];
        }
    }
}

All of these files are in the same folder, so there shouldn’t be an issue there. I am using terminal to compile by typing “javac FBArrayList.java”. My compiler output looks like this:

 FBArrayList.java:106: cannot find symbol
symbol  : method expandInsert(int,FBList.Person)
location: class FBList.Person[]
            arrayList.expandInsert(i, person);
                     ^
FBArrayList.java:108: cannot find symbol
symbol  : method insertAtEnd(int,FBList.Person)
location: class FBList.Person[]
            arrayList.insertAtEnd(i, person);
                     ^
FBArrayList.java:118: cannot find symbol
symbol  : method shrink(int)
location: class FBList.Person[]
        arrayList.shrink(i);
                 ^
3 errors
  • 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-18T15:31:36+00:00Added an answer on June 18, 2026 at 3:31 pm

    Since Person is an inner class, its name needs to be qualified with the name of the outer class:

    protected void expandInsert(int i, FBList.Person person){
        FBList.Person[] temp = new FBList.Person[arrayList.length * 2];
        ...
        // and so on...
    }
    

    EDIT: Removed a suggestion to make class static because the class is nested inside an interface. The suggestion would have been required for classes nested inside classes; for interfaces, static is optional.

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

Sidebar

Related Questions

I am working on this WebAPI project and I need to create unit tests
So I have been working on this project for a short while now. I
I'm working on this project and I have to open a new browser tab.
I'm working on this surface project where we have a bing maps control and
I have an audio project I'm working on using BASS from Un4seen. This library
I am working on online pdf library project. In this I have a feature
I have this Project model: class Project < ActiveRecord::Base validates :status, :inclusion => {
Okay so, I have this project structure: package A.B class SuperClass (this class is
I have this WinForms project (based on this one , but modified for SharePoint
I have a project that I have recently started working on seriously but had

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.