Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: java Hashmap

  1. #1
    Junior Member
    Join Date
    Oct 2017
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java Hashmap

    Hello... I have the follow part of a code:
    HashMap<String, String> dict = new HashMap<>();

    dict.put("UK", "United Kingdom");
    dict.put("USA", "Unites States of America");

    If i give the key "UK" i want to have as result the value "United Kingdom" It's done

    my problem is: i want the follow example
    if i have the follow Input: " i want to visit UK" i want to have as output this: " i want to visit United Kingdom"

    How can i do it???? Thank you

  2. #2
    Member John Joe's Avatar
    Join Date
    Jun 2017
    Posts
    268
    My Mood
    Amused
    Thanks
    8
    Thanked 18 Times in 18 Posts

    Default Re: java Hashmap

    How you assign the key ? From user input ?
    Whatever you are, be a good one

  3. #3
    Junior Member
    Join Date
    Oct 2017
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java Hashmap

    Yes

Similar Threads

  1. Replies: 1
    Last Post: April 3rd, 2014, 02:11 PM
  2. Java hashmap access without exception
    By Bingo90 in forum Exceptions
    Replies: 5
    Last Post: October 18th, 2013, 05:57 AM
  3. Hashmap
    By srkmca07 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 31st, 2013, 07:36 AM
  4. Hashmap
    By ryan12345 in forum Java Theory & Questions
    Replies: 6
    Last Post: November 2nd, 2012, 07:04 PM
  5. HashMap usage in Java
    By neo_2010 in forum Collections and Generics
    Replies: 2
    Last Post: September 18th, 2009, 02:12 AM

Tags for this Thread