• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Java | TreeMap CIP | Question 7

What is the output of ,

import java.util.*;

class HelloWorld {

    public static void main(String[] args) {

      TreeMap<Integer, String> m = new TreeMap<Integer, String>();

      m.put(10, "gfg");

      m.put(16, "IDE");

      m.put(25, "courses");

      System.out.println( m );

      for( Map.Entry<Integer, String>e:m.entrySet() )

        System.out.println( e.getKey() + " " + e.getValue() );

    }

}

(A)

{10=gfg, 16=IDE, 25=courses}
 

(B)

10 gfg

16 IDE

25 courses

(C)

{10=gfg, 16=IDE, 25=courses}

10 gfg

16 IDE

25 courses
 

(D)

None of these

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments