I'm having a problem with my game. I have two classes the problem is the the enemy class needs to know where the play is so it can follow it and the player class needs to know the enemy class to know possible enemys on the screen that it can intersect with. So for example A( B b) B( A a). I'm not sure how to solve this.
Sounds like the Enemy objects need a reference to an array/Collection of Players and Player objects need a reference to an array/Collection of enemies. Try something and if you can't solve it, shows us what you build and why tell us it failed. Then it will be easier to help you.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
You could make a grid/tile layout for your game and then just check if an enemy and the player are in the same tile.
Or you can calculate rectangles (using java's Rectangle class) from the sprite images and see if they collide.
You can use these ways to detect collision with any game objects.