Question 4
Consider the Java code given below.
import java.util.*;class Stock { String symbol; String company; int sharesTraded;
public Stock(String sym, String comp, int shares) { symbol = sym; company = comp; sharesTraded = shares; }}public class Test { public static void printStocks(ArrayList<Stock> stockList) { var map = new LinkedHashMap<String, Integer>(); for (Stock s : stockList) { map.put(s.symbol, map.getOrDefault(s.symbol, 0) + s.sharesTraded); } for (Map.Entry<String, Integer> e : map.entrySet()) { System.out.println(e.getKey() + " = " + e.getValue()); } } public static void main(String[] args) { ArrayList<Stock> stockList = new ArrayList<Stock>(); stockList.add(new Stock("AAPL", "Apple", 1500)); stockList.add(new Stock("MSFT", "Microsoft", 2000)); stockList.add(new Stock("GOOGL", "Alphabet", 1200)); stockList.add(new Stock("AAPL", "Apple", 800)); printStocks(stockList); }}What will the output be?