What’s the result of the following code?
public static void main(String[] args) {
    Map map = new HashMap();
    map.put("a", 100);
    map.put("b", 200);
    map.put("c", 300);
    map.put("d", 400);
    
    // Gets EntrySet view of keys and values 
    Set> mapSet = map.entrySet();
    
    for (Map.Entry entrance : mapSet) {
        System.out.print(entrance.getKey() + ":");
        System.out.println(entrance.getValue());
    }
}

Q:

Which of the following declarations is correct for a list that is expected to contain integers?

Q:

What’s the result of the following code? ArrayList list = new ArrayList(); list.add(“A”); list.add(“B”); list.add(0, “D”); list.add(“C”); System.out.print(list.get(0)); System.out.print(list.get(2));

Q:

What’s the result of the following code? public static void main(String[] args) { Map map = new HashMap(); map.put(“a”, 100); map.put(“b”, 200); map.put(“c”, 300); map.put(“d”, 400); // Gets EntrySet view of keys and values Set<Map.Entry> mapSet = map.entrySet(); for (Map.Entry entrance : mapSet) { System.out.print(entrance.getKey() + “:”); System.out.println(entrance.getValue()); } }

Q:

Which of the following matches “one letter or underscore followed by one or more letters, digits, and/or underscores” using a regular expression in Java?

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments