1. Keep instance variables as private. Always, unless there is a solid reason to do differently.
2. Why you choosing such cryptic variable names as: b, x, y, a, c, d? Can you tell me without looking to code, what variable
a or
c are meant to represent? Sure you can't, I couldn't too. That shouldn't happen when you write code,
you should know exactly what variable is representing by looking to its name and that should happen instantly.
3. Why you decided to omit curly braces around
if statement? Line 30. Better not to do so, especially when you learning to program.
4. One more style thing. Always use spaces around operators +, -, =, >, <, otherwise code becomes difficult to read.
5. Method name
addindex. That should read as
addIndex. I presume you know that. Try to follow that, that is considered as a good coding practice.
6. Leave an empty line between each declared method. That would help an eye to distinct where one method ends and where other begins.
That is it for a while from me
