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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:21:44+00:00 2026-06-13T05:21:44+00:00

I was in need of a dynamic database of objects and after some research,

  • 0

I was in need of a dynamic “database” of objects and after some research, decided to use ArrayList. However, I cannot modify the arraylist with the code as follows:

public static ArrayList cprofiles;
...
cprofiles = new ArrayList();
...
...
Customer newc = new Customer (lna, fna, sinum, year, month, day);
cprofiles.add (newc);

After this declaration, I am trying to call to methods within the object using the following format cprofiles.get(0).getName() but I am getting an error stating

cannot find symbol (pointing to .getName())

when I try to compile the program. I have spent about an hour researching the proper method to modify this in an ArrayList but the sources I have found seem to suggest that I what I am doing is indeed correct.
Please aid me spotting my error and how I may fix it.

Thanks!

  • 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-13T05:21:46+00:00Added an answer on June 13, 2026 at 5:21 am

    You should use the generic version of ArrayList, and not the raw version:

    List<Customer> cprofiles = new ArrayList<Customer>();
    

    If you just use ArrayList, the compiler doesn’t know what your list contains, so everything is considered as an Object. And you thus need to cast the returned object to its actual type:

    Customer c = (Customer) list.get(0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem I have some pages that need dynamic data from website to generate output
I need to create some dynamic menus in a VS2010 SDI application I'm writing.
I need to create some dynamic functionality and am unsure of where to begin.
I have two django sites that use the same database and share some of
I'm trying to use EF 4.1 with Code First POCO objects against a legacy
I have a fixed-length data file need to persistence into database. I use a
I need some help with MVC architecture. I use the following architecture for an
Short question: I need to turn a dynamic image pulled from a database into
I need some tangible guidance on implementing list of value objects in my distributed
EDIT: Database names have been modified for simplicity I'm trying to get some dynamic

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.