Here by using "new" keyword I am creating object for Map interface (in Java we cannot create objects for interface, generally). I do not understand, without implementing Map interface which is TypeScript based, how the code works?
let map1= new Map()
map1.set(12,"User1");
map1.forEach((k,v) => console.log(k,v))
In Java I am implementing the interface Map using HashMap class, I am able to create object of HashMap class. In Java, I am not allowed to create Map object using "new" keyword:
public class User{
public void createMap(){
Map<Integer,String> map1= new HashMap();
map1.put(12,"NameOne");
}
}