tell me output | Sololearn: Learn to code for FREE!

-2

tell me output

Fill in the blanks to declare a HashMap, add two items, and print one of them. HashMap<String, String> m = HashMap<String, String>(); m.put("A", "First"); m. ("B", "Second"); System.out.println(m. ("B"));

7/8/2018 5:04:16 PM

NGIRIMANA Schadrack

23 Answers

New Answer

+12

new, put, get

+6

Declare a HashMap using the "new" keyword, add the second item using the put method, use the get method to get access to the item and print it. Please read this lesson carefully: https://www.sololearn.com/learn/Java/2181/ If you want to know the output of this code, you can run it in the Code Playground.

+6

Ben Allen (Njinx), this is not prohibited, the question is programming-related, and users can ask for an explanation of what they don't understand. Though I believe that it's better to go back to previous lesson(s) and also read comments to the lessons/quizzes to find useful information.

+5

Ben Allen (Njinx), this is a quiz from Java course.

+2

NezhnyjVampir I feel like that's cheating. The challenges are just competitive quizzes. Uses other resources other than your knowledge is straight up cheating. I feel this should be prohibited. Let the user ask for help on a question they got wrong after the quiz, not during it.

+2

new put get

+1

NezhnyjVampir Is this question allowed?

+1

you can use this HashMap<String, String> m = new HashMap<String, String>(); m.put("A", "First"); m. put ("B", "Second"); System.out.println(m. get ("B"));

+1

Drag and drop from the options below to iterate and print all of the items in the list of Integers. Answer :- Iterator<Integer> it = list.iterator(); while (it.hasNext()) { System.out.println(it.next());

0

We can't..... Fill.... in... the .... blanks..... Suggest this as a quiz for challenges!

0

Paul Grasser I'm guessing this is a challenge question that he's cheating on.

0

What is the output of this code? List<Integer> list = new ArrayList<Integer>(); list.add(10); list.add(20); list.add(30); Iterator<Integer> it = list.iterator(); it.next(); System.out.println(it.next()); Answer :- 20

0

Fill in the blanks to determine whether the file exists. Answer:- class A { public static void main(String args[ ]) { File file = newFile("a.txt"); if(file.exists()) { System.out.println("Yes"); } } }

0

Drag and drop from the options below to read and print the content of the file a.txt, and then close it. Answer:- try { File f = new File("a.txt"); Scanner sc = new Scanner(f); while (sc.hasNext()) { String a = sc.next(); String b = sc.next(); System.out.println(a + " " + b); } sc.close(); } catch (Exception e) { System.out.println("Error"); }

0

The answers in order: new put get

0

new put get

0

0

answer>>> second

-1

-1

new,put,get