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

  • Home
  • SEARCH
  • 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 7516385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:06:51+00:00 2026-05-30T01:06:51+00:00

I have implemented a hashmap in a method (call it method a) and in

  • 0

I have implemented a hashmap in a method (call it method a) and in that method a I have called another method (call it method b) from which I transfer the hashmap built in method a to method b. Problem is that when I try to get the values of hmap in method b, it didn’t allow me to write the statement for that.

In class analyzer I have 2 methods method a and method b. I have called a method b from the statement below:

analyzer v=new analyzer();
v.b(hMap1, 1);

In method b, I try to obtain the values of hmap1 but it does not allow me to write:

public HashMap b(HashMap x,int i)
{
  System.out.println( x.get("6").dstip);
} 

It does not allow me to write .dstip where as when I write this printing
statement in method a, it gives the results on console. I have made the hashmap public, i dont know then why its not allowing me to write the desired statement.

  • 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-30T01:06:52+00:00Added an answer on May 30, 2026 at 1:06 am

    Your HashMap is untyped, so invoking the get method on it returns instances of type Object. There is no public property on Object called dstip, so your compilation fails. Of course your code snippet would work if Java was dynamically typed, but thats totally off topic.

    You should declare and pass around your HashMap with an appropriate parametized type. Say:

    Map<MyDStipBean> map = new HashMap<MyDStipBean>();
    public Map<MyDStipBean> b(Map<MyDStipBean> x,int i) {
        System.out.println( x.get("6").dstip);
    }
    

    On a side note, your Java code doesn’t follow best practices for naming or property access.

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

Sidebar

Related Questions

I have a service running in my Android application which contains a HashMap that
We have implemented a popup window as a modal dialog using the IE method:
I have a package-private interface called AbstractServer which offers three methods: start() , stop()
I have an object Producer which internally starts a thread that will listen for
I have a custom made class called Graph in which I use adjacency lists.
HashMapList keeps its elements inside a HashMap) and when I call add method this
I have a lua table that I use as a hashmap, ie with string
I have a Library application which is already implemented in spring MVC. I need
I have a simple application that reads data in small strings from large text
I have a class which I want to set up as keys in HashMap.

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.