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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:12:54+00:00 2026-05-24T01:12:54+00:00

Please be gentle while answering, I am not a java developer (or developer in

  • 0

Please be gentle while answering, I am not a java developer (or developer in General)

While trying xml parsing with java I came across following –

NodeList nodelist = document.getElementsByTagName("item");

Herein xml dom object let me collect all objects depending on tag name I provide, but return type is an Interface called – nodelist. Since interface can not be instantiated it was a bit surprising for me.

Keeping break point and debugging the code I realized that I actually get object for class DeepNodeListImpl which implements NodeList interface.

How does this happen? How does java know to return object of “some implementation” held by my Interface “object” in the statement declared above.

One more thing – while reading the java api I found that IIOMetadataNode implements the NodeList but my previous code snippets does not get me object of type IIOMetadataNode

  • 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-05-24T01:12:55+00:00Added an answer on May 24, 2026 at 1:12 am

    In the code for getElementByTagName there will be something like

    NodeList nodeList = new DeepNodeListImpl();
    // do something with nodeList
    return nodeList;
    

    Java “knows” to use this type because the code for that method will explicitly choose the implementation.

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

Sidebar

Related Questions

Please be gentle, I'm a newb to this IoC/MVC thing but I am trying.
Learning Java, so be gentle please. Ideally I need to create an array of
Disclaimer: i still suck at writing scripts please be gentle if this is a
I'm just starting with Windsor, so please be gentle :) I have a scenario
Please suggest some good resources to start writing Java Web services.
Please read the whole question. I'm not looking for an approach to managing multi-lingual
Please bear with me, I'm just learning C++. I'm trying to write my header
This is my first post, so please be gentle. I've been playing around with
I'm using the following to define root while in development: define('LOCAL_URL', 'http://localhost/~xampp/Mysite'); define('REMOTE_URL', 'http://example.com');
Totally new to Drupal so be gentle please! Let's say I have a number

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.