Sorry if this is basic but I am starting java and this is not any assignment but why is my simple test program failing ?
static public class pair
{
public int x;
public int y;
public pair(int a , int b)
{
x = a;
y = b;
}
}
public static void main(String args[])
{
HashMap<pair,Integer>m = new HashMap<pair,Integer>();
m.put(new pair(1,2), 3);
if(m.containsKey(new pair(1,2)))
{
System.out.println("is there " + m.get(new pair(1,2)));
}
}