Q:

Access a Java Hashtable with int and byte key

I have a Hashtable to find objects by number.  Let's assume I do
Hashtable<Integer, MyClass> table = ...
table.put(10, myObject);

and query this with a byte or Byte object that also has value 10, then I get no result. 
Byte b = new Byte(10);
table.get(b); // -> null
table.get((int)b); // -> myObject
table.get(10); // -> myObject
table.get((byte)10); // -> null

Byte and Integer objects are different, I know.  But it compiles and both have the same hashcode, namely the value 10.  Shouldn't both find the object? 
The byte value on one of my cases is unchangeable.  I can cast it to int but I would like to understand what's going on here. 
Edit: Let me make clearer what my problem was.  I thought as this hashlist has an Integer as key type, either I should get an error if I use something different that an int (which is converted into integer) or another number type is automatically converted into int.  This made me wonder. 

A:

It is not enough they got same hashCode, when you call get method, the key should also equals the one you put before. 
Byte and Integer are different classes, so they are not equal with each other, that's why you got null with table.get(b) or table.get((byte)10).