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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:36:06+00:00 2026-06-13T11:36:06+00:00

This is a homework problem that i have been asked to do. Create an

  • 0

This is a homework problem that i have been asked to do.

Create an outer ArrayList and insert two ArrayList into it.

ArrayList<Customer> customers1 = new ArrayList<Customer>();
ArrayList<CustomerOtherDetails> customers2 = new ArrayList<CustomerOtherDetails>();
ArrayList<ArrayList> outerList = new ArrayList<ArrayList>();

These are the three ArrayList which are created, there are two separate sample classes Customer and CustomerOtherDetails which are present. I would be adding the reference variables to both arrayLists (customers1 and customers2) by doing customers1.add(customer) etc. I am asked to do sample things like adding a new customer, searching a new customer, sorting etc. all of this from the nested ArrayList

The problem i am facing currently is that i am unable to print details of values pointed by the reference variables in my array list.

When i try to print out values using get(), i am only able to print out like this

[[new.Customer@3972aa3f], [new.advanced.CustomerOtherDetails@17072b90]]
  • 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-13T11:36:07+00:00Added an answer on June 13, 2026 at 11:36 am

    You need to override the public String toString() method in your Customer class and CustomerOtherDetails class.

    This is how you’d do it:

    public class Customer { 
         // ... other code
    
        @Override
        public String toString() {
            return "Customer: " + ... ; // append instance variable values here
        }
    }
    

    The toString method is defined in the base Object class that all other classes inherit from in Java. It gets implicitly called whenever you try to convert an object to a String, for example through System.out.println.

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

Sidebar

Related Questions

This is a homework problem that I have. I have been doing some research
So for Homework I have to create this program that reads from a text
This is not a homework problem. This questions was asked to one of my
This is my homework, but please read my problem description first. I have to
I am stumped on this homework problem. I think I have the right answer
I have been given a homework assignment where I need to create a captcha
For homework we have been given the bathroom synchronization problem. I have been struggling
so i have this homework and this is the given problem: Per-minute charging offers
I have this school assignment that I've been working on and am totally stumped
I have this insane homework where I have to create an expression to validate

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.