HashMap | and LinkedHashMap CIP | Question 9

Last Updated :
Discuss
Comments

What is the output of the code,

Java
import java.util.*;
class HelloWorld {
    public static void main(String[] args) {
      HashMap<String, Integer> m = new HashMap<String, Integer>();
      m.put("gfg", 10);
      m.put("ide", 16);
      m.put("courses", 25);
      if( m.containsKey("ide"))
        System.out.println("yes");
     else
        System.out.println("no");
     m.remove("ide");
     System.out.println(m.size());
    }
}



 

no

3

yes

3

yes

2

no

2

Share your thoughts in the comments