You are viewing a single comment's thread. Return to all comments →
//Complete this code or write your own from scratch import java.util.; import java.io.;
class Solutions{ public static void main(String []argh) {
Map <String,Integer> hashMapPhoneRecord = new HashMap<>(); Scanner in = new Scanner(System.in); //System.out.println("Enter nth value"); int n=in.nextInt(); in.nextLine(); for(int i=0;i<n;i++) { String name=in.nextLine(); int phone=in.nextInt(); hashMapPhoneRecord.put(name, phone); in.nextLine(); } while(in.hasNext()) { String s=in.nextLine(); if(hashMapPhoneRecord.containsKey(s)) System.out.println(s + "=" + hashMapPhoneRecord.get(s)); else System.out.println("Not Found"); } in.close(); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java Map
You are viewing a single comment's thread. Return to all comments →
//Complete this code or write your own from scratch import java.util.; import java.io.;
class Solutions{ public static void main(String []argh) {
}