- 3

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"));

8th Jul 2018, 5:04 PM
NGIRIMANA Schadrack
NGIRIMANA Schadrack - avatar
23 Answers
+ 13
new, put, get
24th Nov 2018, 5:44 PM
Fabio Kovacs
Fabio Kovacs - avatar
+ 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.
8th Jul 2018, 6:53 PM
NezhnyjVampir
+ 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.
8th Jul 2018, 7:37 PM
NezhnyjVampir
+ 5
Ben Allen (Njinx), this is a quiz from Java course.
8th Jul 2018, 7:02 PM
NezhnyjVampir
+ 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.
9th Jul 2018, 12:51 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 2
new put get
30th Apr 2019, 2:42 PM
Dharshine
Dharshine - avatar
+ 1
NezhnyjVampir Is this question allowed?
8th Jul 2018, 7:10 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 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"));
19th May 2019, 3:51 PM
misbah bagaskara05
misbah bagaskara05 - avatar
+ 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());
2nd Jul 2020, 6:02 AM
Gourav Tomar
Gourav Tomar - avatar
0
We can't..... Fill.... in... the .... blanks..... Suggest this as a quiz for challenges!
8th Jul 2018, 5:47 PM
Paul Grasser
Paul Grasser - avatar
0
Paul Grasser I'm guessing this is a challenge question that he's cheating on.
8th Jul 2018, 6:56 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
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
2nd Jul 2020, 6:01 AM
Gourav Tomar
Gourav Tomar - avatar
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"); } } }
2nd Jul 2020, 6:05 AM
Gourav Tomar
Gourav Tomar - avatar
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"); }
2nd Jul 2020, 6:09 AM
Gourav Tomar
Gourav Tomar - avatar
0
The answers in order: new put get
11th Mar 2021, 12:12 AM
Rusz Tamás
Rusz Tamás - avatar
0
new put get
1st Jan 2022, 11:49 AM
M.I.M.Aqueel
M.I.M.Aqueel - avatar
0
Second
7th Apr 2022, 3:12 PM
Suman Saurav Das
Suman Saurav Das - avatar
0
answer>>> second
9th May 2022, 4:33 PM
U.L.F. Feroza
- 1
get
19th Sep 2018, 1:07 PM
nazirjon
- 1
new,put,get
16th Sep 2019, 6:53 AM
PRATIK NAVALE