100 Days of Java challenges

Day 21 - HashMap

Write a program that performs the following tasks:
  • Initialise a HashMap named students with Integer key and String value to save roll-numbers and names of students
  • Add items to the HashMap students
  • Access items from the students HashMap using get() and print the students name
  • Check if a key exists in the HashMap
  • Remove an item from the HashMap
  • Print the number of elements(size) in the HashMap
  • Print all the students names one by one by looping through the HashMap using keySet()
  • Print all the students names one by one by looping through the HashMap using entrySet()

      Community|Blog|Logic Puzzles|Careers|Contact Us
      Have Feedback or want to contribute? Email: hello[@]100DaysOfCode.io
      100DaysOfCode@2024