What I am doing is transposing a c# project to java for practice in writing custom classes.
Unfortunately I cant figure out what the person is doing with “this” keyword inside the constructor.
// C# Code - How is this written in Java?
public Player this[int x, int y]
{
get { return squares[x, y]; }
set { squares[x, y] = value; }
}
I have transposed a lot of the code and am kind of stuck on this. I cant seem to find any information on this particular instance in Java. does anyone have a good lead for me?
That’s not in the constructor. That’s the declaration of an indexer. The Java equivalent would be something like: