Advertisement
sergAccount

Untitled

Feb 14th, 2021
752
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.mycompany.ja11;
  7.  
  8. import java.util.HashMap;
  9. import java.util.Map;
  10. import java.util.Set;
  11.  
  12. /**
  13.  *
  14.  * @author Admin
  15.  */
  16. public class Main4 {
  17.    
  18.     public static void main(String[] args) {
  19.         // Map        
  20.         Map<String, String> m = new HashMap<>();
  21.         // помещаем объект по ключу в Map
  22.         m.put("KEY", "VALUE"); // KEY VALUE
  23.        
  24.         Map<Integer, String> m1= new HashMap<>();
  25.         m1.put(10, "value");
  26.         //m1.put("STRRRR", "value");
  27.        
  28.         int r = 11;
  29.         m1.put(r, "value");
  30.        
  31.         Set<String> set = m.keySet();
  32.         for(String key: set){
  33.             System.out.println("key=" + key);
  34.         }                
  35.     }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement