Question: Hello, I wrote a method to check all the elements in a 2D array. If it's neighbor is an * it would increment a count

Hello, I wrote a method to check all the elements in a 2D array. If it's neighbor is an * it would increment a count and then replace the value with a count. I'd like to write the same method in recursion.

How can I in Java write a recursive method that checks all of a 2D array neighbors and returns a count.

For example in the array

*...

.*..

It would return

*210

2*10

This must be done with Java and recursion.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!