200k views
0 votes
What output is displayed when the code that follows is executed? HashMap sales = new HashMap<>(); sales.put("January", 389.45); sales.put("February", 432.89); sales.put("March", 275.30); for (Map.Entry sale : sales.entrySet()) { System.out.println(sale.getKey() + ": " + sale.getValue()); }

User DChhapgar
by
4.9k points

1 Answer

2 votes

Answer:

March: 275.30

January: 389.45

February: 432.89

Step-by-step explanation:

The code to be executed is a Java code. Since the For loop used is based on Sale, when the code is complied it will print the output in the order of sale as below:

March: 275.30

January: 389.45

February: 432.89

User Scoopzilla
by
4.6k points