Saturday, April 27, 2019

what will be the output of the following java code?

Problem statement:
what will be the output of the following code?

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
  1. public class Solutions {
  2.     public static void main(String[] args) {
  3.         HashMap<Integer, String> m = new HashMap<>();
  4.         m.put(1001,"A");
  5.         m.put(1002,"B");
  6.         //Collections.unmodifiableMap(m);
  7.         m.put(1001,"C");
  8.         System.out.println(m);
  9.     }
  10. }
Output: {1001=C, 1002=B}

No comments:

Post a Comment

How to run standalone mock server on local laptop

 Please download the standalone wiremock server from Direct download section at the bottom of the page.  Download and installation Feel fre...