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 7788473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:00:55+00:00 2026-06-01T21:00:55+00:00

I have an ArrayList of objects, which are used in subclasses of a helperclass.

  • 0

I have an ArrayList of objects, which are used in subclasses of a helperclass. I’m sending the data needed to the subclass, eg new subclass(ArrayListObject), and these subclasses are handled in a map structure in the helperclass. Since a single ArrayListObject is stored in the helperclass, I assumed it would be linked in the subclasses, which need this object for calculations. However, when changed the ArrayListObject is not changed in the subclasses, from what I’m seeing in the debugger.

Is there a way to make this a pointer to another class variable? Or is the most appropriate way to handle this to make the subclass receive a reference to the helperclass in the constructor, to call a helperclass.getArrayObject method?

  • 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-01T21:00:58+00:00Added an answer on June 1, 2026 at 9:00 pm

    What you are trying to accomplish, a pointer, is not available in Java. To work around this, you should make the ArrayListObject a protected field of the helperclass. There are two ways to go from here:

    1. If the field is never accessed outside of the class and its subclasses, call super.mArrayList whenever you need the value.
    2. If the field needs to be accessed everywhere, create a public getArrayListObject() that returns the value of the object.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have different objects which is used to store the data from DB in
In my case I have 2D ArrayList full of objects that have data which
At the moment inside the class I have ArrayList which the objects are stored
Ok, so I have an ArrayList (arrBok) , which is full of book objects
I have an array list of objects in my application. private static ArrayList<Player> userList=new
I have an ArrayList which I add some Objects to it dynamically, and I
I have a list of objects and Comparator which is used for sorting and
I currently have an arraylist in which I add blossom objects ( which fall
I have created some business objects which are created with the data from the
I currently have an arraylist in C# which holds the my data base table

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.