Which declaration can be inserted at (1) so that the program compiles without errors?.
public class Main { // (1) INSERT DECLARATION HERE... public long getNum(String name) { Long number = accounts.get(name); return number == null ? 0 : number; }//from ww w. ja v a 2s . c o m public void setNum(String name, long number) { accounts.put(name, number); } }
Select the one correct answer.
HashMap()
;(b)
accounts.getNum(name)
returns an Object, which cannot be converted to a Long.