Positions and values, getters, setters

Hey I'm programming a game that is divided into squares, like a grid.

Therefore I have positions such as (x,y) in that grid.

Now I want to give some of these positions a certain int value, so I created a new class called Field, that had both the position arguments and my int value:

(x, y, value) - that part works well.

But now I want to get that value (if there is one, otherwise return null), by only typing in the position type arguments.

I thought something like, if an object of type Field with those two (x,y) coordinates existed, it should return it's int value, otherwise return null. But I can't get it to work.

just to simplify even more:

I want to return the value of a current position, if it has one, by only calling the coordinates of type Position.

I can't seem to solve this problem, and I'm really in a hurry, so please help.