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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:59:31+00:00 2026-06-09T14:59:31+00:00

I got the following problem: I made a custom list CustomList which extends ArrayList

  • 0

I got the following problem:

I made a custom list CustomList which extends ArrayList and added a new method to it:

public class CustomList extends ArrayList<CustomObj> {

    public CustomObj get(String searchName) {
    ...
    }
}

now in my MainActivity.java I make a new object of this CustomList, but I’m using:

List<CustomObj> list = new CustomList();    (1)

and NOT:

CustomList list = new CustomList();         (2)

so far so good!
but when I try to access the function get(String searchName), there is no function I could use!

why? cause when I call it when creating the CustomList via (2) it’ll totally work

  • 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-09T14:59:33+00:00Added an answer on June 9, 2026 at 2:59 pm

    its is because you are making List(Interface) has no any such method defined , you are making object of CustomList but reference type is List .so it will give you compile time errer if you force to call this method on List reference.This is an example of simple Polymorphism.

    You can imagine a case where Mordern car extends Old age car and mordern car has GPS navigation system where as old doesn’t in this case if you try to get the detail of navigation system by old car reference which doesn’t know about GPS , you wont get anything.

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

Sidebar

Related Questions

I've got following problem: (c#) There is some class (IRC bot), which has method,
In got the following problem: I made a server which is able to handle
Ive got the following problem. I have a model called user which has a
I made another thread which solved my problem, however I got the report reviewed
Ive got a following problem. I made a XUL toolbar. Toolbar works correctly, it
I got the following problem: In my Android App I am using a table
I've got the following problem: I have two tables: (simplified) +--------+ +-----------+ | User
In Eclipse UI, I got the following problem, If you see left side, the
I have got a the following problem: I have got multi-step form where in
I've got the following theoretical problem. I'd like to be able to create multiple

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.